Esempio n. 1
0
 public static function DeleteConfigBySearchId($searchId)
 {
     if (strlen($searchId) <= 0) {
         return array('ERROR' => 'Config is`t found for undefined number');
     }
     $orm = VI\ConfigTable::getList(array('filter' => array('=SEARCH_ID' => (string) $searchId)));
     $config = $orm->fetch();
     if (!$config) {
         $result = array('ERROR' => 'Config is`t found for number: ' . $searchId);
     } else {
         $orm = VI\QueueTable::getList(array('filter' => array('=CONFIG_ID' => $config["ID"])));
         while ($row = $orm->fetch()) {
             VI\QueueTable::delete($row['ID']);
         }
         VI\ConfigTable::delete($config["ID"]);
         $result = array('RESULT' => 'OK', 'ERROR' => '');
     }
     return $result;
 }
Esempio n. 2
0
 public static function DeletePhoneConfig($configId)
 {
     $configId = intval($configId);
     $result = VI\ConfigTable::getList(array('select' => array('ID', 'SEARCH_ID'), 'filter' => array('=ID' => $configId)));
     $config = $result->fetch();
     if (!$config) {
         return false;
     }
     $needChangePortalNumber = false;
     VI\ConfigTable::delete($configId);
     if ($config['SEARCH_ID'] == CVoxImplantConfig::GetPortalNumber()) {
         $needChangePortalNumber = true;
     }
     $result = VI\QueueTable::getList(array('select' => array('ID'), 'filter' => array('=CONFIG_ID' => $configId)));
     while ($row = $result->fetch()) {
         VI\QueueTable::delete($row['ID']);
     }
     $firstPhoneNumber = '';
     $result = VI\ConfigTable::getList(array('select' => array('ID', 'SEARCH_ID')));
     while ($row = $result->fetch()) {
         if (!$firstPhoneNumber) {
             $firstPhoneNumber = $row['SEARCH_ID'];
         }
     }
     if (!$firstPhoneNumber) {
         CVoxImplantConfig::SetModeStatus(CVoxImplantConfig::MODE_RENT, false);
     }
     if ($needChangePortalNumber) {
         if ($firstPhoneNumber) {
             CVoxImplantConfig::SetPortalNumber($firstPhoneNumber);
         } else {
             CVoxImplantConfig::SetPortalNumber(CVoxImplantConfig::LINK_BASE_NUMBER);
         }
     }
     return true;
 }