From 99282e28b4cdfc9d3570ab1bfb1bff7fa9c5db01 Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Fri, 3 May 2024 12:58:17 +0200 Subject: [PATCH 1/6] feat: Use Tax ID as Vat Number option --- src/modules/registrars/dondominio/lib/Actions/Action.php | 4 ++++ .../registrars/dondominio/lib/Actions/getConfigArray.php | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/src/modules/registrars/dondominio/lib/Actions/Action.php b/src/modules/registrars/dondominio/lib/Actions/Action.php index 90b2011..1b783d7 100644 --- a/src/modules/registrars/dondominio/lib/Actions/Action.php +++ b/src/modules/registrars/dondominio/lib/Actions/Action.php @@ -296,6 +296,10 @@ protected function getVATNumber() // Search by Custom Field if (empty($vatNumber) && !empty($this->params['vat'])) { + if ($this->params['useTaxID'] && array_key_exists('tax_id', $this->params) && is_string($this->params['tax_id']) && $this->params['tax_id'] !== '' ) { + return $this->params['tax_id']; + } + $vatNumberCustomField = $this->app->getService('whmcs')->getCustomFieldByFieldName($this->params['vat']); // Try to find custom field through old select version diff --git a/src/modules/registrars/dondominio/lib/Actions/getConfigArray.php b/src/modules/registrars/dondominio/lib/Actions/getConfigArray.php index f23bd31..b984fda 100644 --- a/src/modules/registrars/dondominio/lib/Actions/getConfigArray.php +++ b/src/modules/registrars/dondominio/lib/Actions/getConfigArray.php @@ -55,6 +55,11 @@ public function __invoke() "Options" => "," . implode(",", $customFields), "Description" => "Custom field containing the VAT Number for your customers" ], + 'useTaxID' => [ + 'FriendlyName' => 'Use tax ID', + 'Type' => 'yesno', + 'Description' => 'Use Tax ID as VAT Number' + ], //FOACONTACT "foacontact" => [ "FriendlyName" => "FOA Contact", From 62fac71e27fb18f0f93b0af99a8f3222bdf1ca20 Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Fri, 3 May 2024 13:08:12 +0200 Subject: [PATCH 2/6] docs: CHANGELOG --- CHANGELOG-en.md | 4 ++++ CHANGELOG-es.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/CHANGELOG-en.md b/CHANGELOG-en.md index 144c92f..05df5b3 100644 --- a/CHANGELOG-en.md +++ b/CHANGELOG-en.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.2.20] - 2024-05-03 +### Changed +- Use `Tax ID` as `Vat Number` registrar option. + ## [2.2.19] - 2024-03-11 ### fixed - `adminContactType` in dondominiossl diff --git a/CHANGELOG-es.md b/CHANGELOG-es.md index bf3b24a..7df18b0 100644 --- a/CHANGELOG-es.md +++ b/CHANGELOG-es.md @@ -7,6 +7,10 @@ y este proyecto se adhiere a [Semantic Versioning](https://semver.org/spec/v2.0. ## [Pendiente por lanzar] +## [2.2.20] - 2024-05-03 +### Changed +- Opción para utilizar `Tax ID` como `Vat Number` en opciones del registrador. + ## [2.2.19] - 2024-03-11 ### fixed - `adminContactType` en dondominiossl From ae7bf8bc504b13c8d5bfcbb59f1d46da49aa7cd6 Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Fri, 3 May 2024 13:09:32 +0200 Subject: [PATCH 3/6] ci: Update Version --- README-en.md | 2 +- README.md | 2 +- composer.json | 2 +- src/modules/addons/dondominio/version.json | 4 ++-- src/modules/registrars/dondominio/version.json | 4 ++-- src/modules/servers/dondominiossl/version.json | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README-en.md b/README-en.md index 307687f..889c2df 100644 --- a/README-en.md +++ b/README-en.md @@ -8,7 +8,7 @@ This project has all the developed integrations between MrDomain and WHMCS. ## Status | Version | |:--------| -| 2.2.19 | +| 2.2.20 | ## Requirements | Name | Version | diff --git a/README.md b/README.md index c9b7495..7d00abc 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Este proyecto contiene todos los módulos desarrollados entre DonDominio y WHMCS ## Estado | Version | |:--------| -| 2.2.19 | +| 2.2.20 | ## Requerimientos | Name | Version | diff --git a/composer.json b/composer.json index 921121f..0a30998 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dondominio/whmcs", "description": "DonDominio - WHCMCS Modules Integration", - "version": "2.2.19", + "version": "2.2.20", "license": "LGPL-3.0-only", "type": "project", "minimum-stability": "dev", diff --git a/src/modules/addons/dondominio/version.json b/src/modules/addons/dondominio/version.json index cfa9002..0de0713 100644 --- a/src/modules/addons/dondominio/version.json +++ b/src/modules/addons/dondominio/version.json @@ -1,4 +1,4 @@ { - "version": "2.2.19", - "releaseDate": "2024-03-11" + "version": "2.2.20", + "releaseDate": "2024-05-03" } diff --git a/src/modules/registrars/dondominio/version.json b/src/modules/registrars/dondominio/version.json index a678a6c..68d4838 100644 --- a/src/modules/registrars/dondominio/version.json +++ b/src/modules/registrars/dondominio/version.json @@ -1,4 +1,4 @@ { - "version": "2.2.19", - "releaseDate": "2024-03-11" + "version": "2.2.20", + "releaseDate": "2024-05-03" } \ No newline at end of file diff --git a/src/modules/servers/dondominiossl/version.json b/src/modules/servers/dondominiossl/version.json index cfa9002..0de0713 100644 --- a/src/modules/servers/dondominiossl/version.json +++ b/src/modules/servers/dondominiossl/version.json @@ -1,4 +1,4 @@ { - "version": "2.2.19", - "releaseDate": "2024-03-11" + "version": "2.2.20", + "releaseDate": "2024-05-03" } From 1fdaf5413a25e1201615cdd98f5dc045e696c82e Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Mon, 6 May 2024 09:57:05 +0200 Subject: [PATCH 4/6] feat: Use Tax ID mode in transfer --- .../dondominio/lib/Services/WHMCS_Service.php | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php index a59e3bb..02207f1 100644 --- a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php +++ b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php @@ -299,6 +299,24 @@ public function getDomainExtendedById($id) if (!empty($extDomain->vatnumber)) { return $extDomain; } + + $useTaxID = Capsule::selectOne(' + SELECT * FROM `tblregistrars` + WHERE `tblregistrars`.`registrar` = "dondominio" + AND `tblregistrars`.`setting` = "useTaxID" + ')->value; + + if (!empty($useTaxID) && function_exists('decrypt')) { + $useTaxIDMode = decrypt($useTaxID); + if ($useTaxIDMode === 'on') { + $tax_id = $this->getTaxIDFromDomain($id); + + if ($tax_id->tax_id !== "") { + $extDomain->vatnumber = $tax_id->tax_id; + return $extDomain; + } + } + } $registrarFileName = Capsule::selectOne(' SELECT * FROM `tblregistrars` @@ -318,6 +336,26 @@ public function getDomainExtendedById($id) return $extDomain; } + /** + * Finds client tax_id from domain + * + * @see Illuminate\Database\Connection:selectOne() + * + * @param string $id Domain ID + * + * @return mixed|null + */ + protected function getTaxIDFromDomain($id) + { + return Capsule::selectOne(' + SELECT C.tax_id + FROM tbldomains D + LEFT JOIN tblclients C ON C.id = D.userid + WHERE D.id = ?', + [$id] + ); + } + /** * Finds domain with extra information (client and custom fields related) * From eb35371e8bdd0c4a23810379f8cb98bb904d824d Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Mon, 6 May 2024 10:23:44 +0200 Subject: [PATCH 5/6] feat: Optimize TaxID mode --- .../dondominio/lib/Services/WHMCS_Service.php | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php index 02207f1..8976b77 100644 --- a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php +++ b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php @@ -308,13 +308,9 @@ public function getDomainExtendedById($id) if (!empty($useTaxID) && function_exists('decrypt')) { $useTaxIDMode = decrypt($useTaxID); - if ($useTaxIDMode === 'on') { - $tax_id = $this->getTaxIDFromDomain($id); - - if ($tax_id->tax_id !== "") { - $extDomain->vatnumber = $tax_id->tax_id; - return $extDomain; - } + if ($useTaxIDMode === 'on' && $extDomain->tax_id) { + $extDomain->vatnumber = $extDomain->tax_id; + return $extDomain; } } @@ -336,26 +332,6 @@ public function getDomainExtendedById($id) return $extDomain; } - /** - * Finds client tax_id from domain - * - * @see Illuminate\Database\Connection:selectOne() - * - * @param string $id Domain ID - * - * @return mixed|null - */ - protected function getTaxIDFromDomain($id) - { - return Capsule::selectOne(' - SELECT C.tax_id - FROM tbldomains D - LEFT JOIN tblclients C ON C.id = D.userid - WHERE D.id = ?', - [$id] - ); - } - /** * Finds domain with extra information (client and custom fields related) * From 66d30e984ee29916ac7a5b543b6d1c6e4381c62f Mon Sep 17 00:00:00 2001 From: JAndreuSoler Date: Mon, 6 May 2024 10:24:34 +0200 Subject: [PATCH 6/6] fix: Tax ID comparation --- src/modules/addons/dondominio/lib/Services/WHMCS_Service.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php index 8976b77..ba2e5f1 100644 --- a/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php +++ b/src/modules/addons/dondominio/lib/Services/WHMCS_Service.php @@ -308,7 +308,7 @@ public function getDomainExtendedById($id) if (!empty($useTaxID) && function_exists('decrypt')) { $useTaxIDMode = decrypt($useTaxID); - if ($useTaxIDMode === 'on' && $extDomain->tax_id) { + if ($useTaxIDMode === 'on' && $extDomain->tax_id !== '') { $extDomain->vatnumber = $extDomain->tax_id; return $extDomain; }