Skip to content

Commit ed4dc0b

Browse files
author
Cameron Hall
authored
Fixed #14: Domain sync not working on transferred away domains (#15)
* Fixed #14: Domain sync not working on transferred away domains * Updated error key for transferred away sync trigger
1 parent 0ba1a89 commit ed4dc0b

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

CHANGELOG.md

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

18+
## 2.1.5 [Updated 13/05/2020]
19+
20+
### Fixed
21+
- Fixed domain sync not working on transferred away domains. Fixes [#14](https://github.com/SynergyWholesale/WHMCS-Domains-Module/issues/14)
22+
1823
## 2.1.4 [Updated 20/04/2020]
1924

2025
### Fixed

modules/registrars/synergywholesaledomains/synergywholesaledomains.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ function synergywholesaledomains_Sync(array $params)
739739
{
740740
// Run the sync command on the domain specified
741741
try {
742-
$response = synergywholesaledomains_apiRequest('domainInfo', $params);
742+
$response = synergywholesaledomains_apiRequest('domainInfo', $params, [], false);
743743
} catch (\Exception $e) {
744744
return [
745745
'error' => $e->getMessage(),
@@ -751,13 +751,15 @@ function synergywholesaledomains_Sync(array $params)
751751
->first();
752752

753753
// Sync ID Protection
754-
$idProtect = $response['idProtect'] === 'Enabled';
755-
if ($domain->idprotection != $idProtect) {
756-
Capsule::table('tbldomains')
757-
->where('id', $params['domainid'])
758-
->update([
759-
'idprotection' => (int) $idProtect,
760-
]);
754+
if (isset($response['idProtect'])) {
755+
$idProtect = $response['idProtect'] === 'Enabled';
756+
if ($domain->idprotection != $idProtect) {
757+
Capsule::table('tbldomains')
758+
->where('id', $params['domainid'])
759+
->update([
760+
'idprotection' => (int) $idProtect,
761+
]);
762+
}
761763
}
762764

763765
try {
@@ -875,7 +877,7 @@ function synergywholesaledomains_Sync(array $params)
875877
->first();
876878
// If the domain used to exist in this whmcs installation it's safe to say if we get these errors then
877879
// it has been transferred away to another reseller
878-
if ('Domain Info Failed - Unable to retrieve domain id' === $response['errorMessage']) {
880+
if ('Domain Info Failed - Unable to retrieve domain id' === $response['error']) {
879881
// If now is after the domains expiry date mark it as cancelled
880882
if (time() >= strtotime($selectInfo->expirydate)) {
881883
$note = 'Domain has been marked as cancelled due to not being in your account and, the current date is past the expiry date';
@@ -2350,7 +2352,7 @@ function synergywholesaledomains_adhocTransferSync(array $params, $domainInfo)
23502352
* because the interface has the data fetched prior to this function running.
23512353
*
23522354
* @param array $params The parameters
2353-
* @param object $domainInfo The domain information
2355+
* @param object $domainInfo The domain information from the DB
23542356
*
23552357
* @return array Returns a message containing the updated information.
23562358
*/

0 commit comments

Comments
 (0)