[Added customer management Adrian Georgescu **20070913102314] hunk ./provisioning/provisioning_logic.phtml 1176 + + function printFiltersToForm() { + foreach(array_keys($this->filters) as $filter) { + if (strlen(trim($this->filters[$filter]))) { + printf("",$filter,trim($this->filters[$filter])); + } + } + } + + function updateRecord () { + } hunk ./provisioning/provisioning_logic.phtml 5273 - 'support_web_site' => array('name' => 'Support web site', + 'support_web' => array('name' => 'Support web site', + 'category' => 'sip'), + 'support_email' => array('name' => 'Support email address', + 'category' => 'sip'), + 'support_cdrtool' => array('name' => 'CDRTool address', hunk ./provisioning/provisioning_logic.phtml 5286 + var $customerFields=array( + 'id', + 'username', + 'reseller', + 'firstName', + 'lastName', + 'organization', + 'tel', + 'fax', + 'sip', + 'mobile', + 'email', + 'web', + 'address', + 'postcode', + 'city', + 'state', + 'country' + ); hunk ./provisioning/provisioning_logic.phtml 5458 + if ($this->rows == 1 ) { + $this->showCustomer($customer->id); + } + hunk ./provisioning/provisioning_logic.phtml 5499 + } + + function getCustomer($id) { + + $this->SOAPEngine->soapclient->addHeader($this->SOAPEngine->SoapAuth); + $result = $this->SOAPEngine->soapclient->getAccount(intval($id)); + + if (PEAR::isError($result)) { + $error_msg = $result->getMessage(); + $error_fault= $result->getFault(); + $error_code = $result->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SOAPEngine->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + return false; + } else { + return $result; + } + } + + function showCustomer($id) { + $customerInfo=$this->getCustomer($id); + + + print ""; + printf ("",$_SERVER['PHP_SELF']); + print ""; + print " + + + + +
+

Customer data

+ "; + printf (" + + + "); + foreach ($this->customerFields as $item) { + printf (" + + + ", + ucfirst($item), + $customerInfo->$item + ); + } + + print " +
PropertyValue
%s%s
+ "; + + /* + print "
";
+        print_r($customerInfo);
+        print "
"; + */ + + print "
+

Customer properties

+ "; + printf (" + + + + "); + + foreach (array_keys($this->preferenceItems) as $item) { + printf (" + + + ", + ucfirst($this->preferenceItems[$item]['category']), + $item, + $item, + $customerInfo->preferences[$item]['value'] + ); + } + + print " + "; + print " +
CategoryPropertyValue
%s%s
+
+
+ "; + $this->printFiltersToForm(); + + $this->printHiddenFormElements(); + + print ""; + } + + + function updateRecord () { + print "

Updating customer ..."; + if (!$_REQUEST['customer_filter']) return; + $customerInfo=$this->getCustomer($_REQUEST['customer_filter']); + foreach (array_keys($this->preferenceItems) as $item) { + $var_name=$item.'_form'; + $properties[]=array('name' => $item, + 'value' => trim($_REQUEST[$var_name]), + 'category' => $this->preferenceItems[$item]['category'] + ); + + } + + /* + print "

";
+        print_r($properties);
+        print "
"; + */ + + $customerInfo->properties=$properties; + + $this->SOAPEngine->soapclient->addHeader($this->SOAPEngine->SoapAuth); + $result = $this->SOAPEngine->soapclient->updateAccount($customerInfo); + + if (PEAR::isError($result)) { + $error_msg = $result->getMessage(); + $error_fault= $result->getFault(); + $error_code = $result->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SOAPEngine->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + return false; + } else { + return true; + } hunk ./provisioning.phtml 57 + if ($_REQUEST['action']=='Update') $RECORDS->updateRecord(); + hunk ./rating_lib.phtml 2685 - require_once("provisioning_soap_library.phtml"); + require_once("provisioning/provisioning_soap_library.phtml"); hunk ./sip_statistics_lib.phtml 622 - require_once("provisioning_soap_library.phtml"); + require_once("provisioning/provisioning_soap_library.phtml");