Exemplo n.º 1
0
 function DeletePSTNCustomer($dane = NULL)
 {
     if (is_null($dane)) {
         return false;
     }
     $customer_id = $this->DB->GetOne('SELECT customerid FROM hv_pstn WHERE id=? ;', array($dane));
     if (HiperusActions::DelPSTNNumber($dane)) {
         $cusname = $this->DB->GetOne('SELECT name FROM hv_customers WHERE id=? LIMIT 1 ;', array($customer_id));
         $this->DB->Execute('DELETE FROM hv_pstn WHERE id=? ;', array($dane));
         $this->ImportTerminalList($customer_id);
         $this->ImportPSTNList($customer_id);
         $this->DB->Execute('UPDATE hv_pstnusage SET customerid=0, customer_name=NULL WHERE customerid=' . $customer_id . ' ;');
         if ($lista = $this->GetPSTNOneOrList(NULL, $customer_id)) {
             for ($i = 0; $i < count($lista); $i++) {
                 $this->DB->Execute('UPDATE hv_pstnusage SET customerid=' . $customer_id . ' , customer_name=\'' . $cusname . '\' WHERE extension=\'' . $lista[$i]['extension'] . '\' ;');
             }
         }
         return true;
     }
 }