function skipDiallist($dialnumber, $diallistid) { global $locate; $objResponse = new xajaxResponse(); $row = astercrm::getRecordByID($diallistid, 'diallist'); if ($row['dialnumber'] != '') { $row['callresult'] = 'skip'; astercrm::deleteRecord($row['id'], "diallist"); $row['dialednumber'] = $phoneNum; $row['dialedby'] = $_SESSION['curuser']['extension']; $row['trytime'] = $row['trytime'] + 1; astercrm::insertNewDialedlist($row); } else { $objResponse->addAlert($locate->translate("Option failed")); return $objResponse; } $objResponse->addScript("xajax_clearPopup()"); $objResponse->loadXML(getPrivateDialListNumber($_SESSION['curuser']['extension'])); return $objResponse; }
function saveDiallistMain($f) { global $locate; $objResponse = new xajaxResponse(); if ($f['dialnumber'] == '' || empty($f['dialnumber'])) { $objResponse->addAlert($locate->Translate("Dialnumber can not be empty")); return $objResponse->getXML(); } if ($f['campaignid'] == '') { $objResponse->addAlert($locate->Translate("Must select a campaign")); return $objResponse->getXML(); } // check if the assign number belong to this group if ($_SESSION['curuser']['usertype'] != 'admin') { $flag = false; if ($_SESSION['curuser']['usertype'] == 'groupadmin') { if ($f['assign'] == '') { $flag = true; } else { foreach ($_SESSION['curuser']['memberExtens'] as $extension) { if ($extension == $f['assign']) { $flag = true; break; } } } } else { if ($_SESSION['curuser']['extension'] == $f['assign']) { $flag = true; } } if (!$flag) { $objResponse->addAlert('"' . $locate->Translate("Cant insert, please confirm the assign number is in your group") . '"'); return $objResponse->getXML(); } } $id = Customer::insertNewDiallist($f); if ($id) { $objResponse->addAlert($locate->Translate("Add diallist succeed")); $objResponse->addAssign("formaddDiallistInfo", "style.visibility", "hidden"); $objResponse->addClear("formaddDiallistInfo", "innerHTML"); $objResponse->addScript("xajax_showDiallist('" . $_SESSION['curuser']['extension'] . "',0,0,5,'','','','formDiallistPannel','','');"); $objResponse->loadXML(getPrivateDialListNumber($_SESSION['curuser']['extension'])); } else { $objResponse->addAlert($locate->Translate("Add diallist failed")); } return $objResponse->getXML(); }