From 4794e4014e93a76130074a1b74e95a552628425c Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 18 Feb 2020 12:50:04 +1100 Subject: [PATCH 1/2] Fixes #2: Domain sync not accounting for "Sync Next Due Date" setting --- CHANGELOG.md | 4 ++++ .../synergywholesaledomains.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ebc5f4..5d01661 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ Synergy Wholesale WHMCS Domains Module ### Removed - +## 2.0.2 [Updated 18/02/2020] +### Fixed +- Fixed "Next Due Date" not accounting for `Sync Next Due Date` setting on domain sync. Fixes [#1](https://github.com/SynergyWholesale/WHMCS-Domains-Module/issues/2) + ## 2.0.1 [Updated 07/02/2020] ### Fixed - Fixed support for PHP 7.2 and below. Fixes [#1](https://github.com/SynergyWholesale/WHMCS-Domains-Module/issues/1) diff --git a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php index b10e6d2..f2f5b69 100644 --- a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php +++ b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php @@ -2250,6 +2250,8 @@ function synergywholesaledomains_sync_adhoc(array $params) */ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo) { + global $_LANG, $CONFIG; + $response = synergywholesaledomains_TransferSync($params); $update = $syncMessages = []; if (isset($response['error'])) { @@ -2270,11 +2272,11 @@ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo) if ($response['expirydate']) { $newBillDate = $update['expirydate'] = $response['expirydate']; if ($CONFIG['DomainSyncNextDueDate'] && $CONFIG['DomainSyncNextDueDateDays']) { - $timeCalculation = strtotime($response['expirydate']) - strtotime($CONFIG['DomainSyncNextDueDateDays'] . ' days'); - $newBillDate = date('Y-m-d', $timeCalculation); + $unix_expiry = strtotime($response['expirydate']); + $newBillDate = date('Y-m-d', strtotime(sprintf('-%d days', $CONFIG['DomainSyncNextDueDateDays']), $unix_expiry)); } - $update['nextinvoicedate'] = $update['nextduedate'] = $newBillDate; + $update['nextinvoicedate'] = $update['nextduedate'] = $newBillDate; } } @@ -2354,6 +2356,8 @@ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo) */ function synergywholesaledomains_adhocSync(array $params, $domainInfo) { + global $CONFIG; + $response = synergywholesaledomains_Sync($params); $syncMessages = $update = []; if (isset($response['error'])) { @@ -2391,8 +2395,8 @@ function synergywholesaledomains_adhocSync(array $params, $domainInfo) if ($response['expirydate']) { $newBillDate = $update['expirydate'] = $response['expirydate']; if ($CONFIG['DomainSyncNextDueDate'] && $CONFIG['DomainSyncNextDueDateDays']) { - $timeCalculation = strtotime($response['expirydate']) - strtotime($CONFIG['DomainSyncNextDueDateDays'] . ' days'); - $newBillDate = date('Y-m-d', $timeCalculation); + $unix_expiry = strtotime($response['expirydate']); + $newBillDate = date('Y-m-d', strtotime(sprintf('-%d days', $CONFIG['DomainSyncNextDueDateDays']), $unix_expiry)); } if ($newBillDate != $domainInfo->nextinvoicedate) { From 290002fb9cdb84e6b8c111c02d5bae0ca740b245 Mon Sep 17 00:00:00 2001 From: Cameron Hall Date: Tue, 18 Feb 2020 12:50:31 +1100 Subject: [PATCH 2/2] PHP Version no longer includes `[extra]` version information --- CHANGELOG.md | 3 +++ .../synergywholesaledomains/synergywholesaledomains.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d01661..9572e29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ Synergy Wholesale WHMCS Domains Module - ## 2.0.2 [Updated 18/02/2020] +### Changed +- PHP Version sent in API requests no longer include the `[extra]` version details + ### Fixed - Fixed "Next Due Date" not accounting for `Sync Next Due Date` setting on domain sync. Fixes [#1](https://github.com/SynergyWholesale/WHMCS-Domains-Module/issues/2) diff --git a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php index f2f5b69..26a28ad 100644 --- a/modules/registrars/synergywholesaledomains/synergywholesaledomains.php +++ b/modules/registrars/synergywholesaledomains/synergywholesaledomains.php @@ -83,7 +83,7 @@ function synergywholesaledomains_apiRequest($command, array $params = [], array * backwards compatability across WHMCS versions and PHP support. */ $analytics = [ - 'php_ver' => phpversion(), + 'php_ver' => str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION), 'whmcs_ver' => $params['whmcsVersion'], 'whmcs_mod_ver' => SW_MODULE_VERSION, ];