[Added copy function for customers Adrian Georgescu **20071001092600] hunk ./provisioning/ngnpro_client_lib.phtml 409 - $error_msg = $resultRemote->getMessage(); - $error_fault = $resultRemote->getFault(); - $error_code = $resultRemote->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + $this->error_msg = $resultRemote->getMessage(); + $this->error_fault = $resultRemote->getFault(); + $this->error_code = $resultRemote->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SOAPurlRemote,$this->error_msg, $this->error_fault->detail->exception->errorcode,$this->error_fault->detail->exception->errorstring); hunk ./provisioning/ngnpro_client_lib.phtml 421 - $error_msg = $result->getMessage(); - $error_fault = $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + $this->error_msg = $result->getMessage(); + $this->error_fault = $result->getFault(); + $this->error_code = $result->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SOAPurl,$this->error_msg, $this->error_fault->detail->exception->errorcode,$this->error_fault->detail->exception->errorstring); hunk ./provisioning/ngnpro_client_lib.phtml 434 - $error_msg=$result->getMessage(); - $error_fault=$result->getFault(); - $error_code=$result->getCode(); - printf ("

Error roll back at %s: %s (%s): %s",$this->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + $this->error_msg=$result->getMessage(); + $this->error_fault=$result->getFault(); + $this->error_code=$result->getCode(); + printf ("

Error roll back at %s: %s (%s): %s",$this->SOAPurl,$this->error_msg, $this->error_fault->detail->exception->errorcode,$this->error_fault->detail->exception->errorstring); hunk ./provisioning/ngnpro_client_lib.phtml 457 - $error_msg = $result->getMessage(); - $error_fault = $result->getFault(); - $error_code = $result->getCode(); - printf ("

Error from %s: %s (%s): %s",$this->SOAPurl,$error_msg, $error_fault->detail->exception->errorcode,$error_fault->detail->exception->errorstring); + $this->error_msg = $result->getMessage(); + $this->error_fault = $result->getFault(); + $this->error_code = $result->getCode(); + printf ("

Error from %s: %s (%s): %s",$this->SOAPurl,$this->error_msg, $this->error_fault->detail->exception->errorcode,$this->error_fault->detail->exception->errorstring); hunk ./provisioning/ngnpro_client_lib.phtml 963 + function copyRecord () { + } + hunk ./provisioning/ngnpro_client_lib.phtml 6006 - print "

Please press on Confirm to confirm the delete. "; + print "

Please press on Delete again to confirm the delete. "; hunk ./provisioning/ngnpro_client_lib.phtml 6019 - + + unset($this->filters['customer']); hunk ./provisioning/ngnpro_client_lib.phtml 6048 + print ""; + hunk ./provisioning/ngnpro_client_lib.phtml 6051 + print " hunk ./provisioning/ngnpro_client_lib.phtml 6053 - print ""; + + + "; hunk ./provisioning/ngnpro_client_lib.phtml 6067 - print "
"; + + if ($this->adminonly || $this->reseller == $customer->reseller) { + print ""; + print ""; + if ($_REQUEST['action'] == 'Delete' || $_REQUEST['action'] == 'Copy') { + print ""; + } + } + + print "
"; hunk ./provisioning/ngnpro_client_lib.phtml 6068 - - + hunk ./provisioning/ngnpro_client_lib.phtml 6072 + hunk ./provisioning/ngnpro_client_lib.phtml 6545 + function copyRecord () { + //print "

Copy customer ..."; + + if (!strlen($this->filters['customer'])) { + return false; + } + + if (!$_REQUEST['confirm']) { + print "

Please press on Copy again to confirm the copy"; + return true; + } + + if (!$customer=$this->getRecord($this->filters['customer'])) { + return false; + } + + $customer->credit = floatval($customer->credit); + $customer->balance = floatval($customer->balance); + + $properties=array(); + + foreach ($customer->properties as $_property) { + $properties[]=$_property; + } + + $customer->properties=$properties; + + // change username + $customer_new=$customer; + unset($customer_new->id); + + if (!$this->adminonly) { + unset($customer_new->reseller); + } + + $j=1; + while ($j < 9) { + + $customer_new->username=$customer->username.$j; + + $function=array('commit' => array('name' => 'addAccount', + 'parameters' => array($customer_new), + 'logs' => array('success' => sprintf('

Customer id %s has been copied',$customer->id)) + ), + 'rollback' => array('name' => 'deleteAccount', + 'parameters' => array($customer_new) + ) + ); + + if ($this->SOAPEngine->execute($function)) { + // Reset filters to find the copy + unset($this->filters['customer']); + $this->filters['username']=$customer_new->username; + return true; + } else { + if ($this->SOAPEngine->error_fault->detail->exception->errorcode != "5001") { + return false; + } + } + + $j++; + } + } hunk ./provisioning/ngnpro_client_lib.phtml 6680 - hunk ./provisioning.phtml 59 + if ($_REQUEST['action']=='Copy') $RECORDS->copyRecord(); hunk ./provisioning.phtml 61 - if ($_REQUEST['action']=='Update') $RECORDS->updateRecord(); + if ($_REQUEST['action']=='Update') $RECORDS->updateRecord();