From fff5363ff9076ef1c989e5d225c6bcb7f0c3127f Mon Sep 17 00:00:00 2001 From: Nigel Kukard <nkukard@lbsd.net> Date: Wed, 26 Jun 2013 15:46:59 +0200 Subject: [PATCH] Fixed contact input blocks not displaying * Fixed contact input blocks not displaying on client interface Change-Id: Iaf2c244bd0969b4b9ad699cfcfad7bcc49fe84ea --- modules/registrars/cozaepp/cozaepp.php | 38 +++++++++++++++++++------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/modules/registrars/cozaepp/cozaepp.php b/modules/registrars/cozaepp/cozaepp.php index c06e349..534e17d 100644 --- a/modules/registrars/cozaepp/cozaepp.php +++ b/modules/registrars/cozaepp/cozaepp.php @@ -734,25 +734,43 @@ function cozaepp_GetContactDetails($params) { for ($i = 0; ($i < $nodes->length); $i++) { if ($nodes->item($i)->getAttributeNode('type')->nodeValue == 'loc') { $childNodes = $nodes->item($i); - $values["Registrant"]["Contact Name"] = $childNodes->getElementsByTagName('name')->item(0)->nodeValue; - $values["Registrant"]["Organisation"] = $childNodes->getElementsByTagName('org')->item(0)->nodeValue; - $values["Registrant"]["Address line 1"] = $childNodes->getElementsByTagName('street')->item(0)->nodeValue; - $values["Registrant"]["Address line 2"] = $childNodes->getElementsByTagName('street')->item(1)->nodeValue; - $values["Registrant"]["TownCity"] = $childNodes->getElementsByTagName('city')->item(0)->nodeValue; - $values["Registrant"]["State"] = $childNodes->getElementsByTagName('sp')->item(0)->nodeValue; - $values["Registrant"]["Zip code"] = $childNodes->getElementsByTagName('pc')->item(0)->nodeValue; - $values["Registrant"]["Country Code"] = $childNodes->getElementsByTagName('cc')->item(0)->nodeValue; + $results["Registrant"]["Contact Name"] = $childNodes->getElementsByTagName('name')->item(0)->nodeValue; + $results["Registrant"]["Organisation"] = $childNodes->getElementsByTagName('org')->item(0)->nodeValue; + $results["Registrant"]["Address line 1"] = $childNodes->getElementsByTagName('street')->item(0)->nodeValue; + $results["Registrant"]["Address line 2"] = $childNodes->getElementsByTagName('street')->item(1)->nodeValue; + $results["Registrant"]["TownCity"] = $childNodes->getElementsByTagName('city')->item(0)->nodeValue; + $results["Registrant"]["State"] = $childNodes->getElementsByTagName('sp')->item(0)->nodeValue; + $results["Registrant"]["Zip code"] = $childNodes->getElementsByTagName('pc')->item(0)->nodeValue; + $results["Registrant"]["Country Code"] = $childNodes->getElementsByTagName('cc')->item(0)->nodeValue; } } - $values["Registrant"]["Phone"] = $doc->getElementsByTagName('voice')->item(0)->nodeValue; - $values["Registrant"]["Email"] = $doc->getElementsByTagName('email')->item(0)->nodeValue; + $results["Registrant"]["Phone"] = $doc->getElementsByTagName('voice')->item(0)->nodeValue; + $results["Registrant"]["Email"] = $doc->getElementsByTagName('email')->item(0)->nodeValue; } catch (Exception $e) { $values["error"] = 'GetContactDetails/EPP: '.$e->getMessage(); return $values; } + + # What we going to do here is make sure all the attirbutes we return back are set + # If we don't do this WHMCS won't display the options for editing + foreach ( + array("Contact Name","Organisation","Address line 1","Address line 2","TownCity","State","Zip code","Country Code","Phone","Email") + as $item + ) { + # Check if the item is set + if ($results["Registrant"][$item] == "") { + # Just set it to - + $values["Registrant"][$item] = "-"; + } else { + # We setting this here so we maintain the right order, else we get the set + # things first and all the unsets second, which looks crap + $values["Registrant"][$item] = $results["Registrant"][$item]; + } + } + return $values; } -- GitLab