diff --git a/modules/registrars/cozaepp/cozaepp.php b/modules/registrars/cozaepp/cozaepp.php index ddb57164a57e65f7482cd01d3ce18e602276d292..326d6761a360ec0a226d13028958fb0baa2e9b8a 100644 --- a/modules/registrars/cozaepp/cozaepp.php +++ b/modules/registrars/cozaepp/cozaepp.php @@ -857,8 +857,81 @@ function cozaepp_GetContactDetails($params) { return $values; } +/** + * Catching all the different variations of params as encountered by clients + * This has only been reported to have occured in WHMCS 5.2 and 5.3.7 + * References to the occurences of this particular issue can be found at the followinf urls: + * https://gitlab.devlabs.linuxassist.net/awit-whmcs/whmcs-coza-epp/issues/11#note_630 + * http://lists.linuxassist.net/pipermail/whmcs-coza-epp_lists.linuxassist.net/2013-April/000319.html + */ +function _getContactDetailsFromParams($params) { + $results = array(); + + $results["Contact Name"] = $params["contactdetails"]["Registrant"]["Contact Name"]; + + // Catching different variations of Organisation + if (isset($params["contactdetails"]["Registrant"]["Organisation"])) { + $results["Organisation"] = $params["contactdetails"]["Registrant"]["Organisation"]; + } else if (isset($params["contactdetails"]["Registrant"]["Company Name"])) { + $results["Organisation"] = $params["contactdetails"]["Registrant"]["Company Name"]; + } else { + $results["Organisation"] = ""; + } + + // Catching different variations of Address line 1 + if (isset($params["contactdetails"]["Registrant"]["Address line 1"])) { + $results["Address line 1"] = $params["contactdetails"]["Registrant"]["Address line 1"]; + } else if (isset($params["contactdetails"]["Registrant"]["Address 1"])) { + $results["Address line 1"] = $params["contactdetails"]["Registrant"]["Address 1"]; + } else { + $results["Address line 1"] = ""; + } + + // Catching different variations of Address line 2 + if (isset($params["contactdetails"]["Registrant"]["Address line 2"])) { + $results["Address line 2"] = $params["contactdetails"]["Registrant"]["Address line 2"]; + } else if (isset($params["contactdetails"]["Registrant"]["Address 2"])) { + $results["Address line 2"] = $params["contactdetails"]["Registrant"]["Address 2"]; + } else { + $results["Address line 2"] = ""; + } + + // Catching different variations of TownCity + if (isset($params["contactdetails"]["Registrant"]["TownCity"])) { + $results["TownCity"] = $params["contactdetails"]["Registrant"]["TownCity"]; + } else if (isset($params["contactdetails"]["Registrant"]["City"])) { + $results["TownCity"] = $params["contactdetails"]["Registrant"]["City"]; + } else { + $results["TownCity"] = ""; + } + + $results["State"] = $params["contactdetails"]["Registrant"]["State"]; + + // Catching different variations of Postal Code + if (isset($params["contactdetails"]["Registrant"]["Zip code"])) { + $results["Zip code"] = $params["contactdetails"]["Registrant"]["Zip code"]; + } else if (isset($params["contactdetails"]["Registrant"]["ZIP Code"])) { + $results["Zip code"] = $params["contactdetails"]["Registrant"]["ZIP Code"]; + } else if (isset($params["contactdetails"]["Registrant"]["Postcode"])) { + $results["Zip code"] = $params["contactdetails"]["Registrant"]["Postcode"]; + } else { + $results["Zip code"] = ""; + } + // Catching different variations of Country Code + if (isset($params["contactdetails"]["Registrant"]["Country Code"])) { + $results["Country Code"] = $params["contactdetails"]["Registrant"]["Country Code"]; + } else if (isset($params["contactdetails"]["Registrant"]["Country"])) { + $results["Country Code"] = $params["contactdetails"]["Registrant"]["Country"]; + } else { + $results["Country Code"] = ""; + } + $results["Phone"] = $params["contactdetails"]["Registrant"]["Phone"]; + $results["Email"] = $params["contactdetails"]["Registrant"]["Email"]; + + return $results; +} # Function to save contact details function cozaepp_SaveContactDetails($params) { @@ -866,17 +939,20 @@ function cozaepp_SaveContactDetails($params) { $tld = $params["tld"]; $sld = $params["sld"]; # Registrant details - $registrant_name = $params["contactdetails"]["Registrant"]["Contact Name"]; - $registrant_org = $params["contactdetails"]["Registrant"]["Organisation"]; - $registrant_address1 = $params["contactdetails"]["Registrant"]["Address line 1"]; - $registrant_address2 = $params["contactdetails"]["Registrant"]["Address line 2"]; - $registrant_town = $params["contactdetails"]["Registrant"]["TownCity"]; - $registrant_state = $params["contactdetails"]["Registrant"]["State"]; - $registrant_zipcode = $params["contactdetails"]["Registrant"]["Zip code"]; - $registrant_countrycode = $params["contactdetails"]["Registrant"]["Country Code"]; - $registrant_phone = $params["contactdetails"]["Registrant"]["Phone"]; + + $contactDetails = _getContactDetailsFromParams($params); + + $registrant_name = $contactDetails["Contact Name"]; + $registrant_org = $contactDetails["Organisation"]; + $registrant_address1 = $contactDetails["Address line 1"]; + $registrant_address2 = $contactDetails["Address line 2"]; + $registrant_town = $contactDetails["TownCity"]; + $registrant_state = $contactDetails["State"]; + $registrant_zipcode = $contactDetails["Zip code"]; + $registrant_countrycode = $contactDetails["Country Code"]; + $registrant_phone = $contactDetails["Phone"]; #$registrant_fax = '', - $registrant_email = $params["contactdetails"]["Registrant"]["Email"]; + $registrant_email = $contactDetails["Email"]; # Get client instance try {