Exemplo n.º 1
0
 if (!$quiet) {
     print sizeof($forwarded) . "\n";
 }
 if (!$quiet) {
     print "Download internal : ";
 }
 sleep(3);
 $internal = HiperusActions::Getbilling($from, $to, null, null, false, null, 'internal');
 if (!$quiet) {
     print sizeof($internal) . "\n";
 }
 if (!$quiet) {
     print "Download vpbx : ";
 }
 sleep(3);
 $vpbx = HiperusActions::Getbilling($from, $to, null, null, false, null, 'vpbx');
 if (!$quiet) {
     print sizeof($vpbx) . "\n";
 }
 sleep(5);
 $bill = array_merge($incoming, $outgoing, $disa, $forwarded, $internal, $vpbx);
 $ter = array();
 $DB->BeginTrans();
 for ($i = 0; $i < sizeof($bill); $i++) {
     if (!isset($ter[$bill[$i]['id_terminal_in']])) {
         $cusid = $DB->GetOne('SELECT customerid FROM hv_terminal WHERE id = ? LIMIT 1;', array($bill[$i]['id_terminal_in']));
         $ter[$bill[$i]['id_terminal_in']] = $cusid ? $cusid : NULL;
     }
     $bill[$i]['customerid'] = $ter[$bill[$i]['id_terminal_in']];
     if (!$DB->GetOne('SELECT 1 FROM hv_billing WHERE id = ? LIMIT 1;', array($bill[$i]['id']))) {
         $DB->Execute('INSERT INTO hv_billing (id,customerid,rel_cause,start_time,start_time_unix,customer_name,terminal_name,ext_billing_id,caller,bill_cpb,duration,calltype,
Exemplo n.º 2
0
 function DeleteTerminal($id = NULL)
 {
     if (is_null($id)) {
         return false;
     }
     $id = intval($id);
     $pstn = $this->DB->GetOne('SELECT extensions FROM hv_terminal WHERE id=? LIMIT 1;', array($id));
     $numery = array();
     $numery = explode("\n", $pstn);
     unset($numery[sizeof($numery) - 1]);
     if (HiperusActions::DelTerminal($id)) {
         for ($i = 0; $i < sizeof($numery); $i++) {
             $this->DB->Execute('UPDATE hv_pstnusage SET customerid=0, customer_name=NULL WHERE extension=? ;', array($numery[$i]));
             $this->DB->Execute('DELETE FROM hv_pstn WHERE extension=? ;', array($numery[$i]));
         }
         $this->DB->Execute('DELETE FROM hv_terminal WHERE id=? ;', array($id));
     }
 }
Exemplo n.º 3
0
 public static function GetCustomerDataExtID($ext_billing_id)
 {
     $hlib = new HiperusLib();
     $r = new stdClass();
     $r->ext_billing_id = $ext_billing_id;
     $response = $hlib->sendRequest("GetCustomerIDByExtBillingID", $r);
     if (!$response->success) {
         throw new Exception("Nie można pobrać danych klienta bazując na identyfikatorze z systemu zewnętrznego.\n" . $response->error_message);
     }
     $id_customer = $response->result_set[0]['id'];
     return HiperusActions::GetCustomerData($id_customer);
 }