Skip to content

Commit 661e73c

Browse files
author
Cameron Hall
authored
Merge pull request #3 from SynergyWholesale/develop
Fixes #2: Domain sync not accounting for "Sync Next Due Date" setting
2 parents 0db21a6 + 290002f commit 661e73c

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ Synergy Wholesale WHMCS Domains Module
1515
### Removed
1616
-
1717

18+
## 2.0.2 [Updated 18/02/2020]
19+
### Changed
20+
- PHP Version sent in API requests no longer include the `[extra]` version details
21+
22+
### Fixed
23+
- 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)
24+
1825
## 2.0.1 [Updated 07/02/2020]
1926
### Fixed
2027
- Fixed support for PHP 7.2 and below. Fixes [#1](https://github.com/SynergyWholesale/WHMCS-Domains-Module/issues/1)

modules/registrars/synergywholesaledomains/synergywholesaledomains.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function synergywholesaledomains_apiRequest($command, array $params = [], array
8383
* backwards compatability across WHMCS versions and PHP support.
8484
*/
8585
$analytics = [
86-
'php_ver' => phpversion(),
86+
'php_ver' => str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION),
8787
'whmcs_ver' => $params['whmcsVersion'],
8888
'whmcs_mod_ver' => SW_MODULE_VERSION,
8989
];
@@ -2250,6 +2250,8 @@ function synergywholesaledomains_sync_adhoc(array $params)
22502250
*/
22512251
function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo)
22522252
{
2253+
global $_LANG, $CONFIG;
2254+
22532255
$response = synergywholesaledomains_TransferSync($params);
22542256
$update = $syncMessages = [];
22552257
if (isset($response['error'])) {
@@ -2270,11 +2272,11 @@ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo)
22702272
if ($response['expirydate']) {
22712273
$newBillDate = $update['expirydate'] = $response['expirydate'];
22722274
if ($CONFIG['DomainSyncNextDueDate'] && $CONFIG['DomainSyncNextDueDateDays']) {
2273-
$timeCalculation = strtotime($response['expirydate']) - strtotime($CONFIG['DomainSyncNextDueDateDays'] . ' days');
2274-
$newBillDate = date('Y-m-d', $timeCalculation);
2275+
$unix_expiry = strtotime($response['expirydate']);
2276+
$newBillDate = date('Y-m-d', strtotime(sprintf('-%d days', $CONFIG['DomainSyncNextDueDateDays']), $unix_expiry));
22752277
}
22762278

2277-
$update['nextinvoicedate'] = $update['nextduedate'] = $newBillDate;
2279+
$update['nextinvoicedate'] = $update['nextduedate'] = $newBillDate;
22782280
}
22792281
}
22802282

@@ -2354,6 +2356,8 @@ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo)
23542356
*/
23552357
function synergywholesaledomains_adhocSync(array $params, $domainInfo)
23562358
{
2359+
global $CONFIG;
2360+
23572361
$response = synergywholesaledomains_Sync($params);
23582362
$syncMessages = $update = [];
23592363
if (isset($response['error'])) {
@@ -2391,8 +2395,8 @@ function synergywholesaledomains_adhocSync(array $params, $domainInfo)
23912395
if ($response['expirydate']) {
23922396
$newBillDate = $update['expirydate'] = $response['expirydate'];
23932397
if ($CONFIG['DomainSyncNextDueDate'] && $CONFIG['DomainSyncNextDueDateDays']) {
2394-
$timeCalculation = strtotime($response['expirydate']) - strtotime($CONFIG['DomainSyncNextDueDateDays'] . ' days');
2395-
$newBillDate = date('Y-m-d', $timeCalculation);
2398+
$unix_expiry = strtotime($response['expirydate']);
2399+
$newBillDate = date('Y-m-d', strtotime(sprintf('-%d days', $CONFIG['DomainSyncNextDueDateDays']), $unix_expiry));
23962400
}
23972401

23982402
if ($newBillDate != $domainInfo->nextinvoicedate) {

0 commit comments

Comments
 (0)