Skip to content

Commit

Permalink
Fixed state validation
Browse files Browse the repository at this point in the history
  • Loading branch information
Cameron Hall authored and Luke McMahon committed May 26, 2020
1 parent a9bc4bd commit 90d3328
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ function synergywholesaledomains_SaveContactDetails(array $params)
'technical' => 'Tech',
'billing' => 'Billing',
];

foreach ($contactTypes as $contactType => $whmcs_contact) {
if (!isset($params['contactdetails'][$whmcs_contact])) {
continue;
Expand All @@ -1046,8 +1046,6 @@ function synergywholesaledomains_SaveContactDetails(array $params)
$params['contactdetails'][$whmcs_contact]['Address 3'],
];

$request["{$contactType}_address"] = array_filter($request["{$contactType}_address"]);

$request["{$contactType}_email"] = $params['contactdetails'][$whmcs_contact]['Email'];
$request["{$contactType}_suburb"] = $params['contactdetails'][$whmcs_contact]['City'];
$request["{$contactType}_postcode"] = $params['contactdetails'][$whmcs_contact]['Postcode'];
Expand All @@ -1061,10 +1059,10 @@ function synergywholesaledomains_SaveContactDetails(array $params)

$request["{$contactType}_country"] = $params['contactdetails'][$whmcs_contact]['Country'];
// See if country is AU
if ('AU' == $country) {
if ('AU' == $request["{$contactType}_country"]) {
// It is, so check to see if a valid AU State has been specified
$state = synergywholesaledomains_validateAUState($params['contactdetails'][$whmcs_contact]['State']);
if (!$state) {
if (!empty($params['contactdetails'][$whmcs_contact]['State']) && !$state) {
return [
'error' => 'A Valid Australian State Name Must Be Supplied, EG. NSW, VIC',
];
Expand Down

0 comments on commit 90d3328

Please sign in to comment.