本文整理汇总了PHP中astercrm::getRecordByField方法的典型用法代码示例。如果您正苦于以下问题:PHP astercrm::getRecordByField方法的具体用法?PHP astercrm::getRecordByField怎么用?PHP astercrm::getRecordByField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类astercrm
的用法示例。
在下文中一共展示了astercrm::getRecordByField方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUniquePin
/**
* generate a unique pin number, can be assign length by $len
*
* @param $len (int) pin length
* @return $pin (string) pin number
*/
function generateUniquePin($len = 10)
{
srand((double) microtime() * 1000003);
$prefix = rand(1000000000, 9999999999);
if (is_numeric($len) && $len > 10 && $len < 20) {
$len -= 10;
$min = 1;
for ($i = 1; $i < $len; $i++) {
$min = $min * 10;
}
$max = $min * 10 - 1;
$pin = $prefix . rand($min, $max);
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
while ($curpin) {
$pin = $prefix . rand($min, $max);
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
}
} elseif ($len <= 10) {
$pin = $prefix;
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
while ($curpin) {
$pin = rand(1000000000, 9999999999);
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
}
} else {
$pin = $prefix . rand(1000000000, 9999999999);
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
while ($curpin) {
$pin = $prefix . rand(1000000000, 9999999999);
$curpin = astercrm::getRecordByField('pin', $pin, 'clid');
}
}
return $pin;
}
示例2: workoffcheck
function workoffcheck($f = '')
{
global $locate, $config;
$objResponse = new xajaxResponse();
if ($config['system']['stop_work_verify']) {
if ($f['adminname'] == '') {
return $objResponse;
}
$admininfo = astercrm::getRecordByField('username', $f['adminname'], 'astercrm_account');
if ($admininfo['password'] == $f['Workoffpwd'] && ($admininfo['usertype'] == 'groupadmin' && $admininfo['groupid'] == $_SESSION['curuser']['groupid'] || $admininfo['usertype'] == 'admin')) {
} else {
return $objResponse;
}
}
$objResponse->addAssign("btnWork", "value", $locate->Translate("Start work"));
$objResponse->addEvent("btnWork", "onclick", "workctrl('start');");
$objResponse->addAssign("btnWorkStatus", "value", "");
$objResponse->addAssign("divWork", "innerHTML", "");
$_SESSION['curuser']['WorkStatus'] = '';
$objResponse->addAssign("formWorkoff", "style.visibility", "hidden");
$objResponse->addAssign("formWorkoff", "innerHTML", '');
$objResponse->loadXML(getPrivateDialListNumber($_SESSION['curuser']['extension']));
return $objResponse;
}
示例3: fwrite
if ($reseller_row['callshop_pay_fee']) {
$credit = $p->ipn_data['mc_gross'] - $p->ipn_data['mc_fee'];
} else {
$credit = $p->ipn_data['mc_gross'];
}
$updateCurCredit = $srcCredit - $p->ipn_data['mc_gross'];
$sql = "UPDATE accountgroup SET curcredit = curcredit - {$credit} WHERE id = '" . $account['groupid'] . "'";
$mailto = $reseller_row['epayment_notify_mail'];
$mailTitle = $locate->Translate('Callshop') . ': ' . $account['username'] . ' ' . $locate->Translate('Paymented') . ' ' . $config['epayment']['currency_code'] . ' ' . $p->ipn_data['mc_gross'] . ' ' . $locate->Translate('for') . ' ' . $reseller_row['epayment_item_name'] . ',' . $locate->Translate('Please check it') . ' - ipn';
}
if ($config['epayment']['ipn_log']) {
$logstr .= "txn_id- " . $p->ipn_data['txn_id'] . '| updateCurCreditSQL:' . $sql . "\n";
//fwrite($loghandle,$logstr);
//fclose($loghandle);
}
$txn_res = astercrm::getRecordByField('epayment_txn_id', $p->ipn_data['txn_id'], 'credithistory');
//if($config['epayment']['ipn_log']){
// $loghandle = fopen("upload/paypalipn-epayment.log",'rb');
// $oricontent = fread($loghandle,filesize("upload/paypalipn-epayment.log"));
// fclose($loghandle);
// $loghandle = fopen("upload/paypalipn-epayment.log",'w');
// $logstr = $oricontent;
//}
// check that txn_id has not been previously processed
if ($txn_res['id'] > 0) {
if ($config['epayment']['ipn_log']) {
$logstr .= "txn_res: txn_id- " . $p->ipn_data['txn_id'] . "| Already processed\n";
fwrite($loghandle, $logstr);
fclose($loghandle);
}
exit;
示例4: checkExtensionStatus
function checkExtensionStatus($curid, $type = 'list', $curhover)
{
global $db, $config;
/*
if type is list, then only check some specific extension
or else we get extension list from events
*/
$panellist = array();
$panelphones = array();
if ($type == 'list') {
$i = 0;
foreach ($_SESSION['curuser']['extensions'] as $value) {
$row = astercrm::getRecordByField('username', $value, 'astercrm_account');
$panellist[$row['username']]['extension'] = $row['extension'];
$panellist[$row['username']]['agent'] = $row['agent'];
$panellist[$row['username']]['channel'] = $row['channel'];
$panelphones[] = $row['extension'];
$i++;
}
//$_SESSION['curuser']['extensions_session'] = $panellist;
} else {
$alluser = astercrm::getall('astercrm_account');
while ($alluser->fetchinto($row)) {
$panellist[$row['username']]['extension'] = $row['extension'];
$panellist[$row['username']]['agent'] = $row['agent'];
$panellist[$row['username']]['channel'] = $row['channel'];
$panelphones[] = $row['extension'];
}
}
if (!isset($_SESSION['extension_status'])) {
$status = array();
$callerid = array();
$direction = array();
} else {
/*
because there could be no all extension status data in events
we need to inherit status from sessions
*/
$status = $_SESSION['extension_status'];
$callerid = $_SESSION['callerid'];
$direction = $_SESSION['direction'];
$srcchan = $_SESSION['srcchan'];
$dstchan = $_SESSION['dstchan'];
}
if (!isset($panelphones) or $panelphones == '') {
$panelphones = array();
}
if ($config['system']['eventtype'] == 'curcdr') {
//read all peer status in table peerstatus and save to array $phone_status
$events =& asterEvent::getPeerstatus(0);
$phone_status = array();
while ($events->fetchInto($list)) {
list($tech, $peer) = split('/', $list['peername']);
$phone_status[$peer] = $list['status'];
}
foreach ($panellist as $username => $phone) {
$query = "SELECT * FROM curcdr WHERE (src = '" . $phone['extension'] . "' OR dst = '" . $phone['extension'] . "' OR srcchan = 'agent/" . $phone['agent'] . "' OR dstchan = 'agent/" . $phone['agent'] . "' OR srcchan LIKE '" . $phone['channel'] . "-%' OR dstchan LIKE '" . $phone['channel'] . "-%') AND dstchan != '' AND srcchan != '' AND dst != '' AND src != '' ORDER BY id ASC";
$res = $db->query($query);
if ($res->fetchInto($cdrrow)) {
if ($status[$username] == 1) {
continue;
}
//for check click to transfer
if (!strstr($cdrrow['dstchan'], $cdrrow['dst'])) {
$dst_tmp = trim($cdrrow['dst']);
$cdrrow['dst'] = '';
}
if ($status[$list['peer']] == 1) {
continue;
}
if (strstr($cdrrow['src'], $phone['extension']) or strstr($cdrrow['srcchan'], $phone['channel']) or $cdrrow['srcchan'] == "agent/" . $phone['agent']) {
// dial out
if ($cdrrow['didnumber'] != '') {
$callerid[$username] = trim($cdrrow['didnumber']);
} else {
if (trim($cdrrow['dst']) != '') {
$callerid[$username] = trim($cdrrow['dst']);
} else {
$callerid[$username] = $dst_tmp;
}
}
$direction[$username] = "dialout";
$status[$username] = 1;
$srcchan[$username] = trim($cdrrow['srcchan']);
$dstchan[$username] = trim($cdrrow['dstchan']);
} elseif (strstr($cdrrow['dst'], $phone['extension']) or strstr($cdrrow['dstchan'], $phone['channel']) or $cdrrow['dstchan'] == "agent/" . $phone['agent']) {
//dial in
$callerid[$username] = trim($cdrrow['src']);
$direction[$username] = "dialin";
$status[$username] = 1;
$srcchan[$username] = trim($cdrrow['srcchan']);
$dstchan[$username] = trim($cdrrow['dstchan']);
} else {
$callerid[$username] = '';
$direction[$username] = '';
$status[$username] = 0;
}
} else {
if ($phone_status[$phone['extension']] == 'unknown' || $phone_status[$phone['extension']] == 'unreachable' || $phone_status[$phone['extension']] == '' || $phone_status[$phone['extension']] == 'unregistered') {
$status[$username] = 2;
//.........这里部分代码省略.........
示例5: setGroupBalance
function setGroupBalance()
{
global $config, $locate, $db;
$objResponse = new xajaxResponse();
# 检查session是否存在
if ($_SESSION['curuser']['groupid'] == "") {
return $objResponse;
}
$group = astercrm::getRecordByField("id", $_SESSION['curuser']['groupid'], 'accountgroup');
$startdate = date("Y-m-d") . " 00:00";
$enddate = date("Y-m-d") . " 23:59";
if ($config['system']['useHistoryCdr'] == 1) {
$sql = "SELECT SUM(credit) AS todayAmount,SUM(callshopcredit) AS todayCost FROM historycdr WHERE calldate > '" . $startdate . "' AND calldate < '" . $enddate . "' AND groupid = " . $_SESSION['curuser']['groupid'];
} else {
$sql = "SELECT SUM(credit) AS todayAmount,SUM(callshopcredit) AS todayCost FROM mycdr WHERE calldate > '" . $startdate . "' AND calldate < '" . $enddate . "' AND groupid = " . $_SESSION['curuser']['groupid'];
}
$row = $db->getRow($sql);
$amount = $row['todayAmount'];
// income
if ($amount == '') {
$amount = 0;
}
$creditlimit = $group['creditlimit'];
// limit
$callshopcredit = $row['todayCost'];
// cost
if ($callshopcredit == '') {
$callshopcredit = 0;
}
$curcredit = $group['curcredit'];
// current cost
$balance = $callshopcredit - $curcredit;
//available balance
if ($amount == '') {
$amount = 0;
}
if ($cost == '') {
$cost = 0;
}
$divAmountHtml = '';
if ($config['system']['callshop_status_amount']) {
$divAmountHtml .= ' ' . $locate->Translate("Amount") . ': ' . $amount . ' ';
}
if ($_SESSION['curuser']['limittype'] == '') {
$creditlimit = $locate->Translate("no limit");
$objResponse->addAssign("spanLimitStatus", "innerHTML", $creditlimit);
} else {
$balance = $creditlimit - $curcredit;
if ($balance <= 50) {
if ($balance <= 0) {
$objResponse->addAssign("spanLimitStatus", "innerHTML", $locate->Translate("no credit left all booth locked"));
} else {
$objResponse->addAssign("spanLimitStatus", "innerHTML", $locate->Translate("warning no enough credit"));
}
} else {
$objResponse->addAssign("spanLimitStatus", "innerHTML", $locate->Translate("normal"));
}
}
if ($_SESSION['curuser']['usertype'] == 'groupadmin') {
if ($config['system']['callshop_status_cost']) {
$divAmountHtml .= ' ' . $locate->Translate("Cost") . ': ' . $cost . ' ';
}
if ($config['system']['callshop_status_limit']) {
$divAmountHtml .= ' ' . $locate->Translate("Limit") . ': ' . $creditlimit . ' ';
}
if ($config['system']['callshop_status_credit']) {
$divAmountHtml .= ' ' . $locate->Translate("Current Credit") . ': ' . $curcredit . ' ';
}
if ($config['system']['callshop_status_balance']) {
$divAmountHtml .= ' ' . $locate->Translate("Available Balance") . ': ' . $balance;
}
}
$objResponse->addAssign("divAmount", "innerHTML", $divAmountHtml);
if (is_numeric($config['system']['refreshBalance']) && $config['system']['refreshBalance'] != 0) {
$refreshtime = $config['system']['refreshBalance'] * 1000;
$objResponse->addScript('setTimeout("xajax_setGroupBalance()",' . $refreshtime . ');');
}
#$objResponse->addAlert('balance refreshed');
return $objResponse->getXML();
}
示例6: init
/**
* init page
* @return object xajax response object
*/
function init($username = "", $passwd = "", $lang = 'en_US')
{
global $config, $db;
//echo $username.$passwd.$lang;exit;
//if($_SESSION['curuser']['username'] != $username){
$row = astercrm::getRecordByField("username", $username, "astercrm_account");
if ($row['id'] != '') {
if (md5($row['password']) == $passwd) {
$_SESSION = array();
$_SESSION['curuser']['username'] = trim($username);
$_SESSION['curuser']['extension'] = $row['extension'];
$_SESSION['curuser']['usertype'] = $row['usertype'];
$_SESSION['curuser']['accountcode'] = $row['accountcode'];
$_SESSION['curuser']['agent'] = $row['agent'];
$_SESSION['curuser']['extensions'] = array();
// added by solo 2007-10-90
$_SESSION['curuser']['channel'] = $row['channel'];
$_SESSION['curuser']['groupid'] = $row['groupid'];
if ($row['extensions'] != '') {
$_SESSION['curuser']['extensions'] = split(',', $row['extensions']);
}
}
}
//}
//echo $lang;exit;
list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $lang);
//echo $_SESSION['curuser']['language'];exit;
$locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'portal');
//echo $locate->Translate("Search");exit;
$objResponse = new xajaxResponse();
$objResponse->addAssign("username", "value", $_SESSION['curuser']['username']);
$objResponse->addAssign("extension", "value", $_SESSION['curuser']['extension']);
$objResponse->addAssign("myevents", "innerHTML", $locate->Translate("extension") . $_SESSION['curuser']['extension'] . "-" . $locate->Translate("waiting"));
$objResponse->addAssign("btnShowPortal", "value", $locate->Translate("portal"));
$objResponse->addAssign("btnTransfer", "value", $locate->Translate("Transfer"));
$objResponse->addAssign("btnSearchContact", "value", $locate->Translate("Search"));
$objResponse->addAssign("spanMonitor", "innerHTML", $locate->Translate("monitor"));
$objResponse->addAssign("extensionStatus", "value", 'idle');
$objResponse->addAssign("spanMonitorStatus", "innerHTML", $locate->Translate("idle"));
$objResponse->addAssign("btnMonitorStatus", "value", "idle");
$objResponse->addAssign("btnMonitor", "value", $locate->Translate("start_record"));
$objResponse->addAssign("btnMonitor", "disabled", true);
$objResponse->addAssign("btnCallCtrl", "value", $locate->Translate("Dial"));
$objResponse->addAssign("btnTransfer", "disabled", true);
foreach ($_SESSION['curuser']['extensions'] as $extension) {
$extension = trim($extension);
$row = astercrm::getRecordByField('username', $extension, 'astercrm_account');
$objResponse->addScript("addOption('sltExten','" . $row['extension'] . "','{$extension}');");
}
$speeddial =& astercrm::getAllSpeedDialRecords();
$speednumber['0']['number'] = $_SESSION['curuser']['extension'];
$speednumber['0']['description'] = $_SESSION['curuser']['username'];
$n = 1;
while ($speeddial->fetchInto($row)) {
// Change here by the name of fields of its database table
$speednumber[$n]['description'] = $row['description'];
$speednumber[$n]['number'] = $row['number'];
$n++;
}
$n = count($speednumber);
for ($i = 0; $i < $n; ++$i) {
$objResponse->addScript("addOption('iptDestNumber','" . $speednumber[$i]['number'] . "','" . $speednumber[$i]['description'] . "');");
}
$panelHTML = '<a href=? onclick="xajax_showRecentCdr(\'\',\'recent\');return false;">' . $locate->Translate("recentCDR") . '</a> ';
if ($_SESSION['curuser']['usertype'] != "agent") {
$panelHTML .= '<a href=# onclick="this.href=\'managerportal.php\'">' . $locate->Translate("manager") . '</a> ';
}
if ($config['system']['enable_external_crm'] == false) {
//use internal crm
$objResponse->addIncludeScript("js/astercrm.js");
$objResponse->addIncludeScript("js/ajax.js");
$objResponse->addIncludeScript("js/ajax-dynamic-list.js");
$objResponse->addAssign("divSearchContact", "style.visibility", "visible");
} else {
$objResponse->addIncludeScript("js/extercrm.js");
if ($config['system']['open_new_window'] == false) {
$mycrm = '<iframe id="mycrm" name="mycrm" src="' . $config['system']['external_crm_default_url'] . '" width="100%" frameBorder=0 scrolling=auto height="100%"></iframe>';
$objResponse->addAssign("divCrm", "innerHTML", $mycrm);
} else {
$javascript = "openwindow('" . $config['system']['external_crm_default_url'] . "')";
$objResponse->addScript($javascript);
}
}
$monitorstatus = astercrm::getRecordByID($_SESSION['curuser']['groupid'], 'astercrm_accountgroup');
if ($monitorstatus['monitorforce']) {
$objResponse->addAssign("chkMonitor", "checked", 'true');
$objResponse->addAssign("chkMonitor", "style.visibility", 'hidden');
$objResponse->addAssign("btnMonitor", "disabled", 'true');
}
$objResponse->addAssign("divSearchContact", "style.visibility", "visible");
//if enabled monitor by astercctools
Common::read_ini_file($config['system']['astercc_path'] . '/astercc.conf', $asterccConfig);
if ($asterccConfig['system']['force_record'] == 1) {
$objResponse->addAssign("chkMonitor", "checked", 'false');
$objResponse->addAssign("chkMonitor", "style.visibility", 'hidden');
$objResponse->addAssign("btnMonitor", "disabled", 'true');
//.........这里部分代码省略.........
示例7: searchFormSubmit
function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null)
{
global $locate, $db;
$objResponse = new xajaxResponse();
$searchField = array();
$searchContent = array();
$optionFlag = $searchFormValue['optionFlag'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$searchType = $searchFormValue['searchType'];
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
$divName = "grid";
if ($optionFlag == "export" || $optionFlag == "exportcsv") {
$sql = astercrm::getSql($searchContent, $searchField, $searchType, 'astercrm_account');
//得到要导出的sql语句
$_SESSION['export_sql'] = $sql;
$objResponse->addAssign("hidSql", "value", $sql);
//赋值隐含域
$objResponse->addAssign("maintable", "value", 'astercrm_account');
//赋值隐含域
$objResponse->addAssign("exporttype", "value", $optionFlag);
$objResponse->addScript("document.getElementById('exportForm').submit();");
} elseif ($optionFlag == "delete") {
astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'astercrm_account');
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, '');
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
} elseif ($type == "delete") {
$myrow = astercrm::getRecordByField('username', $_SESSION['curuser']['username'], 'astercrm_account');
$myid = $myrow['id'];
//echo $myid;exit;
if ($myid == $id) {
$objResponse->addAlert($locate->Translate("Can not delete your own account"));
return $objResponse->getXML();
}
$res = Customer::deleteRecord($id, 'astercrm_account');
if ($res) {
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $order, $divName, $ordering, $searchType);
$objResponse = new xajaxResponse();
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
$objResponse->addAssign($divName, "innerHTML", $html);
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
} else {
$html = createGrid($numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType);
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
}
return $objResponse->getXML();
}
示例8: formEdit
//.........这里部分代码省略.........
<td align="left"><input type="text" id="website" name="website" size="35" maxlength="100" value="' . $customer['website'] . '"><BR /><input type="button" value="' . $locate->Translate("browser") . '" onclick="openWindow(xajax.$(\'website\').value);return false;"></td>
</tr>
<tr id="trEditCustomerDetails" name="trEditCustomerDetails">
<td nowrap align="left">' . $locate->Translate("category") . '</td>
<td align="left"><input type="text" id="category" name="category" size="35" value="' . $customer['category'] . '"></td>
</tr>
<tr name="trEditCustomerDetails" id="trEditCustomerDetails" >
<td nowrap align="left">' . $locate->Translate("fax") . '</td>
<td align="left"><input type="text" id="mainFax" name="mainFax" size="35" value="' . $customer['fax'] . '"><input type="text" id="mainFax_ext" name="mainFax_ext" maxlength="8" size="8" value="' . $customer['fax_ext'] . '"></td>
</tr>
<!--*********************************************************-->
<tr id="trEditBankDetails" name="trEditBankDetails">
<td nowrap align="left">' . $locate->Translate("bank_name") . '</td>
<td align="left"><input type="text" id="bankname" name="bankname" size="35" value="' . $customer['bankname'] . '"></td>
</tr>
<tr id="trEditBankDetails" name="trEditBankDetails">
<td nowrap align="left">' . $locate->Translate("bank_zip") . '</td>
<td align="left"><input type="text" id="bankzip" name="bankzip" size="35" value="' . $customer['bankzip'] . '"></td>
</tr>
<tr id="trEditBankDetails" name="trEditBankDetails">
<td nowrap align="left">' . $locate->Translate("bank_account_name") . '</td>
<td align="left"><input type="text" id="bankaccountname" name="bankaccountname" size="35" value="' . $customer['bankaccountname'] . '"></td>
</tr>
<tr id="trEditBankDetails" name="trEditBankDetails">
<td nowrap align="left">' . $locate->Translate("bank_account") . '</td>
<td align="left"><input type="text" id="bankaccount" name="bankaccount" size="35" value="' . $customer['bankaccount'] . '"></td>
</tr>
<tr>
<td colspan="2" align="center"><button id="btnContinue" name="btnContinue" onClick=\'xajax_update(xajax.getFormValues("frmCustomerEdit"),"customer");return false;\'>' . $locate->Translate("continue") . '</button></td>
</tr>
';
} elseif ($type == 'diallist') {
$diallist =& astercrm::getRecordByField('id', $id, 'diallist');
//print_r($diallist);exit;
if ($_SESSION['curuser']['usertype'] == 'admin') {
$res = Customer::getGroups();
$groupoptions .= '<select name="groupid" id="groupid" onchange="setCampaign();">';
while ($row = $res->fetchRow()) {
$groupoptions .= '<option value="' . $row['groupid'] . '"';
if ($row['groupid'] == $diallist['groupid']) {
$groupoptions .= 'selected';
}
$groupoptions .= '>' . $row['groupname'] . '</option>';
}
$groupoptions .= '</select>';
$sql = "SELECT * FROM campaign WHERE groupid ='" . $diallist['groupid'] . "'";
$res =& $db->query($sql);
$campaignoptions .= '<select name="campaignid" id="campaignid" >';
while ($campaign = $res->fetchRow()) {
$campaignoptions .= '<option value="' . $campaign['id'] . '"';
if ($campaign['id'] == $diallist['campaignid']) {
$campaignoptions .= 'selected';
}
$campaignoptions .= '>' . $campaign['campaignname'] . '</option>';
}
$campaignoptions .= '</select>';
$assignoptions = '<input type="text" id="assign" name="assign" size="35" value="' . $diallist['assign'] . '" >';
} elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') {
$groupoptions .= $_SESSION['curuser']['group']['groupname'] . '<input id="groupid" name="groupid" type="hidden" value="' . $_SESSION['curuser']['groupid'] . '">';
$res = Customer::getRecordsByField('groupid', $_SESSION['curuser']['groupid'], 'astercrm_account');
$assignoptions .= '<select name="assign" id="assign">';
while ($row = $res->fetchRow()) {
$assignoptions .= '<option value="' . $row['extension'] . '"';
if ($row['extension'] == $diallist['assign']) {
$assignoptions .= " selected";
示例9: init
/**
* initialize page elements
*
*/
function init($get = '')
{
global $config, $locate;
$objResponse = new xajaxResponse();
if ($get != '') {
$get = rtrim($get, ',');
$get = split(',', $get);
foreach ($get as $item_tmp) {
$item = split(':', $item_tmp);
$get_item[$item[0]] = $item[1];
}
}
$rechargeEable = true;
if ($_SESSION['curuser']['usertype'] == 'reseller') {
$paymentinfoHtml = paymentInfoHtml();
$objResponse->addAssign("paymentInfo", "innerHTML", $paymentinfoHtml);
if ($config['epayment']['epayment_status'] != 'enable' || $config['epayment']['paypal_payment_url'] == '' || $config['epayment']['paypal_account'] == '' || $config['epayment']['pdt_identity_token'] == '' || $config['epayment']['asterbilling_url'] == '' || $config['epayment']['amount'] == '' || $config['epayment']['currency_code'] == '') {
$rechargeEable = false;
} else {
$identity_token = $config['epayment']['pdt_identity_token'];
$receiver_email = $config['epayment']['paypal_account'];
$currency_code = $config['epayment']['currency_code'];
}
} elseif ($_SESSION['curuser']['usertype'] == 'groupadmin') {
$reseller_row = astercrm::getRecordByID($_SESSION['curuser']['resellerid'], 'resellergroup');
if ($reseller_row['epayment_status'] != 'enable') {
$rechargeEable = false;
} else {
$identity_token = $reseller_row['epayment_identity_token'];
$receiver_email = $reseller_row['epayment_account'];
$currency_code = $config['epayment']['currency_code'];
}
}
$objResponse->addAssign("divNav", "innerHTML", common::generateManageNav($skin, $_SESSION['curuser']['country'], $_SESSION['curuser']['language']));
$objResponse->addAssign("divCopyright", "innerHTML", common::generateCopyright($skin));
$infoHtml = InfomationHtml();
$objResponse->addAssign("info", "innerHTML", $infoHtml);
if ($rechargeEable) {
$rechargeInfoHtml = '<table border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F0F0F0" width="600">
<tr>
<td width="26%" height="39" class="td font" align="center">' . $locate->Translate('Recharge By Paypal') . '
</td>
<td width="74%" class="td font" align="center"> </td>
</tr>
<tr><td height="10" class="td"></td>
<td class="td font" align="center"> </td>
</tr>
</table>
<table border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F0F0F0" id="menu" width="600">
<tr bgcolor="#F7F7F7">
<td align="center" valign="top"><b>';
if ($get_item["action"] == 'success') {
if ($get_item['tx'] != '') {
$txn_res = astercrm::getRecordByField('epayment_txn_id', $get_item['tx'], 'credithistory');
// check that txn_id has not been previously processed
if ($txn_res['id'] > 0) {
$rechargeInfoHtml .= $locate->Translate('payment_success');
} else {
if ($identity_token != '') {
$p = new paypal_class();
$p->verify_url = $config['epayment']['paypal_verify_url'];
if ($config['epayment']['pdt_log']) {
$return = $p->paypal_pdt_return($get_item['tx'], $identity_token, true);
} else {
$return = $p->paypal_pdt_return($get_item['tx'], $identity_token);
}
if ($return['flag'] == 'SUCCESS') {
$errorFlag = 0;
// check that receiver_email is your Primary PayPal email
if ($return['pdt']['receiver_email'] != $receiver_email) {
$rechargeInfoHtml .= $locate->Translate('payment_receiver_error') . '</br>';
$errorFlag += 1;
}
// check that payment_amount/payment_currency are correct
if ($return['pdt']['mc_currency'] != $currency_code) {
$rechargeInfoHtml .= $locate->Translate('payment_currency_error') . '</br>';
$errorFlag += 1;
}
if ($return['pdt']['payment_status'] == "Completed") {
if ($errorFlag > 0) {
$rechargeInfoHtml .= $locate->Translate('payment_order_error') . "</br>" . $locate->Translate('payment_may_completed');
} else {
// process Order 不再用pdt处理订单,等待ipn处理
//$process_res = processOrder($return['pdt']);
sleep(1);
$infoHtml = InfomationHtml();
$objResponse->addAssign("info", "innerHTML", $infoHtml);
$rechargeInfoHtml .= $locate->Translate('payment_success');
}
} else {
$rechargeInfoHtml .= $locate->Translate('payment_failed');
}
} else {
//PDT return failed
$rechargeInfoHtml .= $locate->Translate('payment_return_failed');
}
//.........这里部分代码省略.........
示例10: searchFormSubmit
function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null)
{
global $locate, $db;
$objResponse = new xajaxResponse();
$searchField = array();
$searchContent = array();
$optionFlag = $searchFormValue['optionFlag'];
$searchContent = $searchFormValue['searchContent'];
//搜索内容 数组
$searchField = $searchFormValue['searchField'];
//搜索条件 数组
$searchType = $searchFormValue['searchType'];
$ordering = $searchFormValue['ordering'];
$order = $searchFormValue['order'];
$divName = "grid";
if ($optionFlag == "export" || $optionFlag == "exportcsv") {
$joinstr = Customer::createSqlWithStype($searchField, $searchContent, $searchType, 'tickets');
//得到要导出的sql语句
$joinstr = ltrim($joinstr, 'AND');
$sql = "SELECT tickets.ticketname,astercrm_accountgroup.groupname, campaign.campaignname,ticketcategory.ticketname AS parentname,tickets.cretime,tickets.creby FROM tickets LEFT JOIN astercrm_accountgroup ON astercrm_accountgroup.id = tickets.groupid LEFT JOIN campaign ON campaign.id = tickets.campaignid LEFT JOIN tickets AS ticketcategory ON ticketcategory.id=tickets.fid";
if ($joinstr != '') {
$sql .= " WHERE " . $joinstr;
}
$_SESSION['export_sql'] = $sql . '';
$objResponse->addAssign("hidSql", "value", $sql);
//赋值隐含域
$objResponse->addAssign("maintable", "value", 'tickets');
//赋值隐含域
$objResponse->addAssign("exporttype", "value", $optionFlag);
$objResponse->addScript("document.getElementById('exportForm').submit();");
} elseif ($optionFlag == "delete") {
astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'tickets');
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, '');
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
} elseif ($type == "delete") {
$myrow = astercrm::getRecordByField('ticketname', $_SESSION['curuser']['ticketname'], 'tickets');
$myid = $myrow['id'];
//echo $myid;exit;
if ($myid == $id) {
$objResponse->addAlert($locate->Translate("Can not delete this ticket"));
return $objResponse->getXML();
}
$res = Customer::deleteRecord($id, 'tickets');
if ($res) {
$html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $order, $divName, $ordering, $searchType);
$objResponse = new xajaxResponse();
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
$objResponse->addAssign($divName, "innerHTML", $html);
} else {
$objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
}
} else {
$html = createGrid($numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType);
$objResponse->addClear("msgZone", "innerHTML");
$objResponse->addAssign($divName, "innerHTML", $html);
}
return $objResponse->getXML();
}
示例11: processAccountData
/**
* function to verify user data
*
* @param $aFormValues (array) login form data
$aFormValues['username']
$aFormValues['password']
$aFormValues['locate']
* @return $objResponse
* @session
$_SESSION['curuser']['username']
$_SESSION['curuser']['extension']
$_SESSION['curuser']['extensions']
$_SESSION['curuser']['country']
$_SESSION['curuser']['language']
$_SESSION['curuser']['channel']
$_SESSION['curuser']['accountcode']
*/
function processAccountData($aFormValues)
{
global $db, $locate, $config;
$objResponse = new xajaxResponse();
$bError = false;
$loginError = false;
list($_SESSION['curuser']['country'], $_SESSION['curuser']['language']) = split("_", $aFormValues['locate']);
$locate = new Localization($_SESSION['curuser']['country'], $_SESSION['curuser']['language'], 'login');
/* check whether the pear had been installed */
$pear_exists_result = class_exists('PEAR');
if (empty($pear_exists_result)) {
$objResponse->addAlert($locate->Translate("Please install php pear"));
return $objResponse;
}
if (!$bError) {
//$query = "SELECT * FROM account WHERE username='" . $aFormValues['username'] . "'";
//$res = $db->query($query);
$row = astercrm::getRecordByField("username", $aFormValues['username'], "astercrm_account");
if ($row['id'] != '') {
if ($row['password'] == $aFormValues['password']) {
$identity = astercrm::calculateAgentOntime('login', trim($aFormValues['username']));
if ($identity) {
$update = astercrm::updateAgentOnlineTime('login', date('Y-m-d H:i:s'), $row['id']);
}
if ($aFormValues['rememberme'] == "forever") {
// set cookies for three years
setcookie("username", $aFormValues['username'], time() + 94608000);
setcookie("password", $aFormValues['password'], time() + 94608000);
setcookie("language", $aFormValues['locate'], time() + 94608000);
} else {
// destroy cookies
setcookie("username", "", time() - 3600);
setcookie("password", "", time() - 3600);
setcookie("language", "", time() - 3600);
$username = '';
$password = '';
$language = 'en_US';
$checked = false;
}
$_SESSION = array();
$_SESSION['curuser']['username'] = trim($aFormValues['username']);
$_SESSION['curuser']['extension'] = $row['extension'];
$_SESSION['curuser']['usertype'] = $row['usertype'];
$_SESSION['curuser']['usertype_id'] = $row['usertype_id'];
$_SESSION['curuser']['accountid'] = $row['id'];
$_SESSION['curuser']['accountcode'] = $row['accountcode'];
$_SESSION['curuser']['agent'] = $row['agent'];
$_SESSION['curuser']['callerid'] = trim($row['callerid']);
$_SESSION['curuser']['update_online_interval'] = date("Y-m-d H:i:s");
// added by solo 2007-10-90
$_SESSION['curuser']['channel'] = $row['channel'];
$_SESSION['curuser']['extensions'] = array();
$_SESSION['curuser']['groupid'] = $row['groupid'];
$privilege = array();
if ($row['usertype_id'] > 0) {
$privileges = $db->getAll("SELECT * FROM user_privileges WHERE user_type_id='" . $row['usertype_id'] . "'");
foreach ($privileges as $p) {
$privilege[$p['page']][$p['action']] = 1;
}
}
$_SESSION['curuser']['privileges'] = $privilege;
if ($row['extensions'] != '') {
$_SESSION['curuser']['extensions'] = split(',', $row['extensions']);
}
//check extensions if exists in account table
foreach ($_SESSION['curuser']['extensions'] as $key => $value) {
$exten_row = astercrm::getRecordByField("username", $value, "astercrm_account");
if ($exten_row['id'] == '') {
unset($_SESSION['curuser']['extensions'][$key]);
}
}
// if it's a group admin, then add all group extension to it
if ($row['usertype'] == 'groupadmin' || is_array($_SESSION['curuser']['privileges']['systemstatus']) || is_array($_SESSION['curuser']['privileges']['import'])) {
$_SESSION['curuser']['memberExtens'] = array();
$_SESSION['curuser']['memberNames'] = array();
$_SESSION['curuser']['memberAgents'] = array();
$groupList = astercrm::getGroupMemberListByID($row['groupid']);
while ($groupList->fetchInto($groupRow)) {
$_SESSION['curuser']['memberExtens'][] = $groupRow['extension'];
$_SESSION['curuser']['memberNames'][] = $groupRow['username'];
if ($groupRow['agent'] != '') {
$_SESSION['curuser']['memberAgents'][] = $groupRow['agent'];
}
//.........这里部分代码省略.........