diff --git a/library/NGNPro/Records/TrustedPeers.php b/library/NGNPro/Records/TrustedPeers.php index 6d82b94..fc34c57 100644 --- a/library/NGNPro/Records/TrustedPeers.php +++ b/library/NGNPro/Records/TrustedPeers.php @@ -1,602 +1,624 @@ array('type'=>'boolean', 'name' => 'MS Teams'), 'prepaid' => array('type'=>'boolean'), 'tenant' => array('type'=>'string'), + 'carrierName' => array('type'=>'string', 'name' => 'LCR carrier'), + 'originator' => array('type'=>'string', 'name' => 'LCR originator'), 'callLimit' => array('type'=>'integer', 'name' => 'Capacity'), 'blocked' => array('type'=>'integer') ); var $Fields = array( 'description' => array('type'=>'string'), 'authToken' => array('type'=>'string', 'name' => 'Authentication token') ); public function __construct($SoapEngine) { $this->filters = array( 'ip' => trim($_REQUEST['ip_filter']), 'tenant' => trim($_REQUEST['tenant_filter']), 'description' => trim($_REQUEST['description_filter']), 'msteams' => trim($_REQUEST['msteams_filter']) ); parent::__construct($SoapEngine); $this->sortElements = array( 'changeDate' => 'Change date', 'description' => 'Description', 'ip' => 'Address' ); } function listRecords() { $this->showSeachForm(); // Insert credetials $this->SoapEngine->soapclient->addHeader($this->SoapEngine->SoapAuth); // Filter $filter = array( 'ip' => $this->filters['ip'], 'description' => $this->filters['description'], 'tenant' => $this->filters['tenant'], 'msteams' => 1 == intval($this->filters['msteams']) ); // Range $range = array( 'start' => intval($this->next), 'count' => intval($this->maxrowsperpage) ); // Order if (!$this->sorting['sortBy']) $this->sorting['sortBy'] = 'description'; if (!$this->sorting['sortOrder']) $this->sorting['sortOrder'] = 'ASC'; $orderBy = array( 'attribute' => $this->sorting['sortBy'], 'direction' => $this->sorting['sortOrder'] ); // Compose query $Query = array( 'filter' => $filter, 'orderBy' => $orderBy, 'range' => $range ); // Call function $this->log_action('getTrustedPeers'); $result = $this->SoapEngine->soapclient->getTrustedPeers($Query); if ($this->checkLogSoapError($result, true)) { return false; } else { $this->rows = $result->total; if ($this->rows && $_REQUEST['action'] != 'PerformActions' && $_REQUEST['action'] != 'Delete') { $this->showActionsForm(); } print <<< END
Id | Owner | Trusted peer | Prepaid | Capacity | MS Teams | Tenant | Description | Blocked | Change date | Actions | ||
%s | %s | %s | %s | %s | %s | %s | %s | %s | %s | +%s | +%s | %s |
|
Error: Missing IP or description. "; return false; } $peer = array( 'ip' => $ipaddress, 'description' => $description, 'callLimit' => intval($callLimit), 'msteams' => 1 == $msteams, 'tenant' => $tenant, + 'carrierName'=> $carrierName, + 'originator'=> $originator, 'blocked' => 0, 'owner' => intval($_REQUEST['owner']), 'customer' => intval($customer), 'reseller' => intval($reseller) ); $function = array( 'commit' => array( 'name' => 'addTrustedPeer', 'parameters' => array($peer), 'logs' => array( 'success' => sprintf('Trusted peer %s has been added', $ipaddress) ) ) ); return $this->SoapEngine->execute($function, $this->html); } function updateRecord() { list($customer, $reseller)=$this->customerFromLogin($dictionary); if (!strlen($this->filters['ip'])) { print "
Error: missing peer address. "; return false; } $peer = array( 'ip' => $this->filters['ip'], 'description' => $_REQUEST['description_form'], 'authToken' => $_REQUEST['authToken_form'], 'tenant' => $_REQUEST['tenant_form'], + 'carrierName' => $_REQUEST['carrierName_form'], + 'originator' => $_REQUEST['originator_form'], 'callLimit' => intval($_REQUEST['callLimit_form']), 'prepaid' => 1 == $_REQUEST['prepaid_form'], 'blocked' => intval($_REQUEST['blocked_form']), 'msteams' => 1 == $_REQUEST['msteams_form'], 'customer' => intval($customer), 'reseller' => intval($reseller) ); $function = array( 'commit' => array( 'name' => 'updateTrustedPeer', 'parameters' => array($peer), 'logs' => array( 'success' => sprintf('Trusted peer %s has been updated', $this->filters['ip']) ) ) ); return $this->SoapEngine->execute($function, $this->html); } function deleteRecord($dictionary = array()) { if (!$dictionary['confirm'] && !$_REQUEST['confirm']) { print "
Please press on Confirm to confirm the delete. "; return true; } if (!strlen($this->filters['ip'])) { print "
Error: missing IP address. "; return false; } $function = array( 'commit' => array( 'name' => 'deleteTrustedPeer', 'parameters' => array($this->filters['ip']), 'logs' => array( 'success' => sprintf('Trusted peer %s has been deleted', $this->filters['ip']) ) ) ); unset($this->filters); return $this->SoapEngine->execute($function, $this->html); } function showSeachFormCustom() { if (intval($this->filters['msteams']) == 1) { $checked_msteams = 'checked'; } else { $checked_msteams = ''; } printf( "