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; }
$reseller_row = astercrm::getRecordByID($resellerid, 'resellergroup'); if ($uesrtype == 'reseller') { $account = astercrm::getRecordByID($userid, 'account'); $srcCredit = $reseller_row['curcredit']; if ($config['epayment']['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 resellergroup SET curcredit = curcredit - " . $credit . " WHERE id = '" . $account['resellerid'] . "'"; $mailto = $config['epayment']['notify_mail']; $mailTitle = $locate->Translate('Reseller') . ': ' . $account['username'] . ' ' . $locate->Translate('Paymented') . ' ' . $config['epayment']['currency_code'] . ' ' . $p->ipn_data['mc_gross'] . ' ' . $locate->Translate('for') . ' ' . $config['epayment']['item_name'] . ',' . $locate->Translate('Please check it') . ' - ipn'; } elseif ($uesrtype == 'groupadmin') { $account = astercrm::getRecordByID($userid, 'account'); $group_row = astercrm::getRecordByID($account['groupid'], 'accountgroup'); $srcCredit = $group_row['curcredit']; 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);
$sec = intval($row['seconds'] % 60); $asr = round($row['arecordNum'] / $row['recordNum'] * 100, 2); $acd = round($row['seconds'] / $row['arecordNum'], 2); $acdminute = intval($acd / 60); $acdsec = intval($acd % 60); $data_tmp[$locate->Translate("groupname")] = $row['groupname']; $data_tmp[$locate->Translate("total calls")] = $row['recordNum']; $data_tmp[$locate->Translate("answered calls")] = $row['arecordNum']; $data_tmp[$locate->Translate("answered duration")] = $hour . $locate->Translate("hour") . $minute . $locate->Translate("minute") . $sec . $locate->Translate("sec"); $data_tmp[$locate->Translate("ASR")] = $asr . '%'; $data_tmp[$locate->Translate("ACD")] = $acdminute . $locate->Translate("minute") . $acdsec . $locate->Translate("sec"); array_push($data, $data_tmp); } } } else { $group = astercrm::getRecordByID($groupid, "astercrm_accountgroup"); foreach ($rows as $key => $row) { if ($key != 'type') { $hour = intval($row['seconds'] / 3600); if ($hour < 3) { $data_tmp['color'] = 'FF0000'; } $minute = intval($row['seconds'] % 3600 / 60); $sec = intval($row['seconds'] % 60); $asr = round($row['arecordNum'] / $row['recordNum'] * 100, 2); $acd = round($row['seconds'] / $row['arecordNum'], 2); $acdminute = intval($acd / 60); $acdsec = intval($acd % 60); $data_tmp[$locate->Translate("groupname")] = $group['groupname']; $data_tmp[$locate->Translate("username")] = $row['username']; $data_tmp[$locate->Translate("name")] = $row['name'];
function listReport($aFormValues) { global $locate; $objResponse = new xajaxResponse(); list($syear, $smonth, $sday, $stime) = split("[ -]", $aFormValues['sdate']); $syear = (int) $syear; $smonth = (int) $smonth; $sday = (int) $sday; list($shours, $smins) = split("[ :]", $stime); $shours = (int) $shours; if ($shours == 0) { $shours = '00'; } $smins = (int) $smins; if ($smins == 0) { $smins = '00'; } list($eyear, $emonth, $eday, $etime) = split("[ -]", $aFormValues['edate']); $eyear = (int) $eyear; $emonth = (int) $emonth; $eday = (int) $eday; list($ehours, $emins) = split("[ :]", $etime); $ehours = (int) $ehours; if ($ehours == 0) { $ehours = '00'; } $emins = (int) $emins; if ($emins == 0) { $emins = '00'; } $ary = array(); $aFormValues['sdate'] = $syear . "-" . $smonth . "-" . $sday . ' ' . $shours . ':' . $smins; $aFormValues['edate'] = $eyear . "-" . $emonth . "-" . $eday . ' ' . $ehours . ':' . $emins; $res = astercrm::readReport($aFormValues['groupid'], $aFormValues['accountid'], $aFormValues['sdate'], $aFormValues['edate'], 'both'); if ($aFormValues['listType'] == "none") { if ($res['all']->fetchInto($myreport)) { $myreport['answeredNum'] = $res['answered']; $result = parseReport($myreport, " "); $html .= "<b>" . $result['html'] . "</b>"; } $objResponse->addAssign("divGeneralList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); return $objResponse; } elseif ($aFormValues['listType'] == "list") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ""; } else { $exportlist = '<input type="submit" value="' . $locate->Translate("export") . '">'; $objResponse->addAssign("exportlist", "innerHTML", $exportlist); $objResponse->addScript("document.getElementById('frmFilter').action = 'dataexport.php';"); $rows = astercrm::readReportAgent($aFormValues['groupid'], $aFormValues['accountid'], $aFormValues["sdate"], $aFormValues["edate"]); $html = '<table class="adminlist" border="1" style="width:800px;">'; $class = 'row1'; if ($rows['type'] == 'grouplist') { $html .= '<tr><th>' . $locate->Translate("groupname") . '</th> <th>' . $locate->Translate("total calls") . '</th> <th>' . $locate->Translate("answered calls") . '</th> <th>' . $locate->Translate("answered duration") . '</th> <th>' . $locate->Translate("ASR") . '</th> <th>' . $locate->Translate("ACD") . '</th></tr>'; $class = 'row1'; foreach ($rows as $key => $row) { if ($key != 'type') { $hour = intval($row['seconds'] / 3600); if ($hour < 3) { $hour = '<font color="red">' . $hour; } $minute = intval($row['seconds'] % 3600 / 60); $sec = intval($row['seconds'] % 60); $asr = round($row['arecordNum'] / $row['recordNum'] * 100, 2); $acd = round($row['seconds'] / $row['arecordNum'], 2); $acdminute = intval($acd / 60); $acdsec = intval($acd % 60); $html .= '<tr class="' . $class . '"><td>' . $row['groupname'] . '</td> <td>' . $row['recordNum'] . '</td> <td>' . $row['arecordNum'] . '</td> <td>' . $hour . $locate->Translate("hour") . $minute . $locate->Translate("minute") . $sec . $locate->Translate("sec") . '</td> <td>' . $asr . '%</td> <td>' . $acdminute . $locate->Translate("minute") . $acdsec . $locate->Translate("sec") . '</td></tr>'; if ($class == 'row1') { $class = 'row0'; } else { $class = 'row1'; } } } } elseif ($rows['type'] == 'agentlist') { //print_r($rows);exit; $group = astercrm::getRecordByID($aFormValues['groupid'], "astercrm_accountgroup"); $html .= '<tr><th>' . $locate->Translate("groupname") . '</th> <th>' . $locate->Translate("username") . '</th> <th>' . $locate->Translate("name") . '</th> <th>' . $locate->Translate("total calls") . '</th> <th>' . $locate->Translate("answered calls") . '</th> <th>' . $locate->Translate("answered duration") . '</th> <th>' . $locate->Translate("ASR") . '</th> <th>' . $locate->Translate("ACD") . '</th></tr>'; $class = 'row1'; foreach ($rows as $key => $row) { //print_r($rows);exit; if ($key != 'type') { $hour = intval($row['seconds'] / 3600); if ($hour < 3) { $hour = '<font color="red">' . $hour; } $minute = intval($row['seconds'] % 3600 / 60); $sec = intval($row['seconds'] % 60); $asr = round($row['arecordNum'] / $row['recordNum'] * 100, 2); $acd = round($row['seconds'] / $row['arecordNum'], 2); $acdminute = intval($acd / 60); $acdsec = intval($acd % 60); $html .= '<tr class="' . $class . '"><td>' . $group['groupname'] . '</td> <td>' . $row['username'] . '</td> <td>' . $row['name'] . '</td> <td>' . $row['recordNum'] . '</td> <td>' . $row['arecordNum'] . '</td> <td>' . $hour . $locate->Translate("hour") . $minute . $locate->Translate("minute") . $sec . $locate->Translate("sec") . '</td> <td>' . $asr . '%</td> <td>' . $acdminute . $locate->Translate("minute") . $acdsec . $locate->Translate("sec") . '</td></tr>'; if ($class == 'row1') { $class = 'row0'; } else { $class = 'row1'; } } } } elseif ($rows['type'] == 'agentsingle') { print_r($rows); exit; } $objResponse->addAssign("divGeneralList", "innerHTML", $html); return $objResponse; } } elseif ($aFormValues['listType'] == "sumyear") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); $html = ""; } else { for ($year = $syear; $year <= $eyear; $year++) { $res = astercrm::readReport($aFormValues['groupid'], $aFormValues['accountid'], "{$year}-1-1 00:00:00", "{$year}-12-31 23:59:59", 'both'); if ($res['all']->fetchInto($myreport)) { $myreport['answeredNum'] = $res['answered']; $html .= "<div class='box'>"; $html .= "{$year} :<br/>"; $html .= "<div>"; $result = parseReport($myreport); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['answeredNum'] += $result['data']['answeredNum']; } } $html .= "<div class='box'>"; $html .= $locate->Translate("total") . " :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $objResponse->addAssign("divGeneralList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); } } elseif ($aFormValues['listType'] == "summonth") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { //for ($year = $syear; $year<=$eyear;$year++){ $year = $syear; for ($month = 1; $month <= 12; $month++) { $res = astercrm::readReport($aFormValues['groupid'], $aFormValues['accountid'], "{$year}-{$month}-1 00:00:00", "{$year}-{$month}-31 23:59:59", 'both'); if ($res['all']->fetchInto($myreport)) { $myreport['answeredNum'] = $res['answered']; $html .= "<div class='box'>"; $html .= "{$year}-{$month} :<br/>"; $html .= "<div>"; $result = parseReport($myreport); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['answeredNum'] += $result['data']['answeredNum']; } } //} $html .= "<div class='box'>"; $html .= $locate->Translate("total") . " :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $objResponse->addAssign("divGeneralList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); } } elseif ($aFormValues['listType'] == "sumday") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { for ($day = $sday; $day <= 31; $day++) { $res = astercrm::readReport($aFormValues['groupid'], $aFormValues['accountid'], "{$syear}-{$smonth}-{$day} 00:00:00", "{$syear}-{$smonth}-{$day} 23:59:59", 'both'); if ($res['all']->fetchInto($myreport)) { $myreport['answeredNum'] = $res['answered']; $html .= "<div class='box'>"; $html .= "{$syear}-{$smonth}-{$day} :<br/>"; $html .= "<div>"; $result = parseReport($myreport); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['answeredNum'] += $result['data']['answeredNum']; } } $html .= "<div class='box'>"; $html .= $locate->Translate("total") . " :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $objResponse->addAssign("divGeneralList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); } } elseif ($aFormValues['listType'] == "sumhour") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionFlash('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { for ($hour = 0; $hour <= 23; $hour++) { $res = astercrm::readReport($aFormValues['groupid'], $aFormValues['accountid'], "{$syear}-{$smonth}-{$sday} {$hour}:00:00", "{$syear}-{$smonth}-{$sday} {$hour}:59:59", 'both'); if ($res['all']->fetchInto($myreport)) { $myreport['answeredNum'] = $res['answered']; $html .= "<div class='box'>"; $html .= "{$syear}-{$smonth}-{$sday} {$hour}:<br/>"; $html .= "<div>"; $result = parseReport($myreport); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['answeredNum'] += $result['data']['answeredNum']; } } $html .= "<div class='box'>"; $html .= $locate->Translate("total") . " :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $objResponse->addAssign("divGeneralList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); } } elseif ($aFormValues['listType'] == "sumgroup") { if ($aFormValues['reporttype'] == "flash") { $objResponse->addScript("actionPieGroup('" . $aFormValues["resellerid"] . "','" . $aFormValues["groupid"] . "','" . $aFormValues["sltBooth"] . "','" . $aFormValues["sdate"] . "','" . $aFormValues["edate"] . "','" . $aFormValues["listType"] . "','" . $aFormValues["hidCurpeer"] . "');"); } else { $res = astercc::readReportPie($aFormValues['resellerid'], $aFormValues['groupid'], $aFormValues['sltBooth'], $aFormValues['sdate'], $aFormValues['edate'], 'destination', $aFormValues['action'], 'limit'); while ($res->fetchInto($row)) { $iid = $row['gid']; if ($aFormValues['resellerid'] == 0 || $aFormValues['resellerid'] == '') { $title = "" . $reseller_arr[$iid]; } else { if ($aFormValues['groupid'] == 0 || $aFormValues['groupid'] == '') { $title = "" . $group_arr[$iid]; } else { $title = "" . $iid; } } $html .= "<div class='box'>"; $html .= "{$title} :<br/>"; $html .= "<div>"; $result = parseReport($row); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $ary['recordNum'] += $result['data']['recordNum']; $ary['seconds'] += $result['data']['seconds']; $ary['credit'] += $result['data']['credit']; $ary['callshopcredit'] += $result['data']['callshopcredit']; $ary['resellercredit'] += $result['data']['resellercredit']; } $html .= "<div class='box'>"; $html .= $locate->Translate("total") . " :<br/>"; $html .= "<div>"; $result = parseReport($ary); $html .= $result['html']; $html .= "</div>"; $html .= "</div>"; $html .= "<div style='clear:both;'></div>"; $objResponse->addAssign("divUnbilledList", "innerHTML", $html); $objResponse->addScript("document.getElementById('exportlist').innerHTML = '';"); $objResponse->addScript("document.getElementById('frmFilter').action = '';"); } } return $objResponse; }
/** * Originate src and dest extension * @param src string extension * @param dest string extension * @return object xajax response object */ function invite($src, $dest, $campaignid = '') { global $config; $src = trim($src); $dest = trim($dest); $objResponse = new xajaxResponse(); //$objResponse->addAssign("dialmsg", "innerHTML", "<b>".$locate->Translate("dailing")." ".$src."</b>"); if ($src == $_SESSION['curuser']['extension']) { $callerid = $dest; } else { //if ($dest == $_SESSION['curuser']['extension']) $callerid = $src; } // else // return $objResponse; $myAsterisk = new Asterisk(); $myAsterisk->config['asmanager'] = $config['asterisk']; $res = $myAsterisk->connect(); if (!$res) { $objResponse->addAssign("mobileStatus", "innerText", "Failed"); } if ($campaignid != '') { $row_campaign = astercrm::getRecordByID($campaignid, "campaign"); if (trim($row_campaign['incontext']) != '') { $incontext = $row_campaign['incontext']; } else { $incontext = $config['system']['incontext']; } if (trim($row_campaign['outcontext']) != '') { $outcontext = $row_campaign['outcontext']; } else { $outcontext = $config['system']['outcontext']; } //if($row_campaign['inexten'] != '') $src = $row_campaign['inexten']; } else { $group_info = astercrm::getRecordByID($_SESSION['curuser']['groupid'], "astercrm_accountgroup"); if ($group_info['incontext'] != '') { $incontext = $group_info['incontext']; } else { $incontext = $config['system']['incontext']; } if ($group_info['outcontext'] != '') { $outcontext = $group_info['outcontext']; } else { $outcontext = $config['system']['outcontext']; } } $strChannel = "local/" . $src . "@" . $incontext . "/n"; if ($config['system']['allow_dropcall'] == true) { $myAsterisk->dropCall($sid, array('Channel' => "{$strChannel}", 'WaitTime' => 30, 'Exten' => $dest, 'Context' => $outcontext, 'Account' => $_SESSION['curuser']['accountcode'], 'Variable' => "{$strVariable}", 'Priority' => 1, 'MaxRetries' => 0, 'CallerID' => $callerid)); } else { $myAsterisk->sendCall($strChannel, $dest, $outcontext, 1, NULL, NULL, 30, $callerid, NULL, $_SESSION['curuser']['accountcode']); } $objResponse->addAssign("divMsg", "style.visibility", "hidden"); return $objResponse->getXML(); }
/** * save account record * @param f array account record * @return objResponse object xajax response object */ function save($f) { global $locate, $db, $config; $objResponse = new xajaxResponse(); $f['extension'] = strtolower($f['extension']); $f['agent'] = strtolower($f['agent']); $f['channel'] = strtolower($f['channel']); if (trim($f['username']) == '' || trim($f['password']) == '' || trim($f['extension']) == '' || trim($f['usertype']) == '' || trim($f['firstname']) == '' || trim($f['lastname']) == '') { //$objResponse->addScript('window.location.href="portal.php";'); //$objResponse->addScript('alert("abc")'); $objResponse->addAlert($locate->Translate("obligatory_fields")); return $objResponse->getXML(); } if (trim($f['usertype']) != 'admin' && trim($f['groupid']) == '') { $objResponse->addAlert($locate->Translate("please add group first")); return $objResponse->getXML(); } $username = $f['username']; $userid = astercrm::checkValues("astercrm_account", "username", $username); if ($userid != '') { $objResponse->addAlert($locate->Translate("username_repeat")); return $objResponse->getXML(); } if ($f['extensions'] == $locate->translate('extensions_input_tip')) { $f['extensions'] = ''; } if ($f['extensions'] != "") { $myExtensions = split(",", astercrm::dbcToSbc($f['extensions'])); if ($f['extensType'] != "username") { foreach ($myExtensions as $exten) { $sqlStr .= "OR extension = '{$exten}'"; } $sqlStr = ltrim($sqlStr, "OR"); $query = "SELECT username From astercrm_account WHERE {$sqlStr}"; astercrm::events($query); $res =& $db->query($query); $myExtensions = array(); while ($res->fetchInto($row)) { $myExtensions[] = $row['username']; $newextensions .= "," . $row['username']; } $f['extensions'] = ltrim($newextensions, ','); } // check the assign username if belong to this group if ($_SESSION['curuser']['usertype'] != 'admin') { $myusernames = $myExtensions; $newextensions = ""; $groupList = astercrm::getGroupMemberListByID($_SESSION['curuser']['groupid']); while ($groupList->fetchInto($groupRow)) { $memberNames[] = $groupRow['username']; } foreach ($myusernames as $myusername) { if (in_array($myusername, $memberNames)) { $newextensions .= ",{$myusername}"; } } $f['extensions'] = ltrim($newextensions, ','); } } // check over if ($f['usertype'] == 'admin') { $f['groupid'] = 0; } $respOk = Customer::insertNewAccount($f); // add a new account if ($respOk == 1) { if ($f['usertype'] != 'admin') { $group = astercrm::getRecordByID($f['groupid'], 'astercrm_accountgroup'); if ($group['billingid'] > 0) { if ($config['billing']['resellerid'] > 0) { $checkreseller = astercrm::getRecordByID($config['billing']['resellerid'], 'resellergroup'); if ($checkreseller['id'] == $config['billing']['resellerid']) { $f['groupid'] = $group['billingid']; $f['resellerid'] = $config['billing']['resellerid']; $f['creditlimit'] = $config['billing']['clidcreditlimit']; $f['limittype'] = $config['billing']['clidlimittype']; $res = Customer::insertNewAccountForBilling($f); if ($res == 1) { $objResponse->addAlert($locate->Translate("add as a billing clid success")); } else { $objResponse->addAlert($locate->Translate("add as a billing clid failed")); } } else { $objResponse->addAlert($locate->Translate("Reseller id is incorrect, can not add this account as a billing clid")); } } else { $objResponse->addAlert($locate->Translate("Reseller id is incorrect, can not add this account as a billing clid")); } } } $html = createGrid(0, ROWSXPAGE); $objResponse->addAssign("grid", "innerHTML", $html); $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("add_account")); $objResponse->addAssign("formDiv", "style.visibility", "hidden"); $objResponse->addClear("formDiv", "innerHTML"); } else { $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_insert")); } return $objResponse->getXML(); }
function barge($srcchan, $dstchan) { global $config, $locate; $myAsterisk = new Asterisk(); $objResponse = new xajaxResponse(); $myAsterisk->config['asmanager'] = $config['asterisk']; $res = $myAsterisk->connect(); if (!$res) { return; } $group_info = astercrm::getRecordByID($_SESSION['curuser']['groupid'], "astercrm_accountgroup"); if ($group_info['incontext'] != '') { $incontext = $group_info['incontext']; } else { $incontext = $config['system']['incontext']; } //if ($group_info['outcontext'] != '' ) $outcontext = $group_info['outcontext']; //else $outcontext = $config['system']['outcontext']; $strChannel = "local/" . $_SESSION['curuser']['extension'] . "@" . $incontext . "/n"; $myAsterisk->Originate($strChannel, '', '', 1, 'meetme', $_SESSION['curuser']['extension'] . $_SESSION['asterisk']['paramdelimiter'] . "pqdx", 30, $_SESSION['curuser']['extension'], NULL, $_SESSION['curuser']['accountcode']); $myAsterisk->Redirect($srcchan, $dstchan, $_SESSION['curuser']['extension'], "astercc-barge", "1"); return $objResponse; }
function resellerPaymentInfoEdit() { global $db, $config, $locate; $objResponse = new xajaxResponse(); if ($_SESSION['curuser']['usertype'] == 'reseller') { $reseller_row = astercrm::getRecordByID($_SESSION['curuser']['resellerid'], 'resellergroup'); $html = Table::Top($locate->Translate("Edit Payment Receiving Infomation"), "formDiv"); if ($reseller_row['epayment_status'] == 'enable') { $enable = 'checked'; } else { $diable = 'checked'; } if ($reseller_row['callshop_pay_fee'] == 'yes') { $yesVal = 'checked'; } else { $noVal = 'checked'; } $html .= ' <!-- No edit the next line --> <form method="post" name="f" id="f"> <table border="1" width="100%" class="adminlist"> <tr> <td nowrap align="left">' . $locate->Translate("Paypal payment url") . '</td> <td align="left">' . $config['epayment']['paypal_payment_url'] . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Paypal verify url") . '</td> <td align="left">' . $config['epayment']['paypal_verify_url'] . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Online payment") . '</td> <td align="left"><input type="radio" id="epayment_status" name="epayment_status" value="enable" ' . $enable . '>' . $locate->Translate("Enable") . '<input type="radio" id="epayment_status" name="epayment_status" value="disable" ' . $diable . '>' . $locate->Translate("Disable") . '</td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Paypal account") . '</td> <td align="left"><input type="text" id="epayment_account" name="epayment_account" size="35" value="' . $reseller_row['epayment_account'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Paypal identity token") . '</td> <td align="left"><input type="text" id="epayment_identity_token" name="epayment_identity_token" size="35" value="' . $reseller_row['epayment_identity_token'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Item name") . '</td> <td align="left"><input type="text" id="epayment_item_name" name="epayment_item_name" size="35" value="' . $reseller_row['epayment_item_name'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Available amount") . '</td> <td align="left"><input type="text" id="epayment_amount_package" name="epayment_amount_package" size="35" maxlength="30" value="' . $reseller_row['epayment_amount_package'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Notify email") . '</td> <td align="left"><input type="text" id="epayment_notify_mail" name="epayment_notify_mail" size="35" value="' . $reseller_row['epayment_notify_mail'] . '"></td> </tr> <tr> <td nowrap align="left">' . $locate->Translate("Callshop pay fee") . '</td> <td align="left"><input type="radio" id="callshop_pay_fee" name="callshop_pay_fee" value="yes" ' . $yesVal . '>' . $locate->Translate("Yes") . '<input type="radio" id="callshop_pay_fee" name="callshop_pay_fee" value="no" ' . $noVal . '>' . $locate->Translate("No") . '</td> </tr> <tr> <td colspan="2" align="center"><button id="submitButton" onClick=\'xajax_resellerPaymentInfoUpdate(xajax.getFormValues("f"));return false;\'>' . $locate->Translate("Continue") . '</button></td> </tr> </table></form>'; $html .= Table::Footer(); $objResponse->addAssign("formDiv", "style.visibility", "visible"); $objResponse->addAssign("formDiv", "innerHTML", $html); } return $objResponse->getXML(); }
function addSchedulerDial($display = '', $number) { global $locate, $db; $objResponse = new xajaxResponse(); if ($display == "none") { $campaignflag = false; $html = '<td nowrap align="left">' . $locate->Translate("Scheduler Dial") . '</td> <td align="left">' . $locate->Translate("Number") . ' : <input type="text" id="sDialNum" name="sDialNum" size="15" maxlength="35" value="' . $number . '">'; if ($number != '') { $curtime = date("Y-m-d H:i:s"); $curtime = date("Y-m-d H:i:s", strtotime("{$curtime} -30 seconds")); $sql = "SELECT campaignid FROM dialedlist WHERE dialednumber = '" . $number . "' AND dialedtime > '" . $curtime . "' "; $curcampaignid = $db->getOne($sql); if ($curcampaignid != '') { $campaignflag = true; $curcampaign = astercrm::getRecordByID($curcampaignid, 'campaign'); $curcampaign_name = $curcampaign['campaignname']; $html .= ' ' . $locate->Translate("campaign") . ' : <input type="text" value="' . $curcampaign_name . '" id="campaignname" name="campaignname" size="15" readonly><input type="hidden" value="' . $curcampaignid . '" id="curCampaignid" name="curCampaignid" size="15" readonly>'; } } if (!$campaignflag) { $campaign_res = astercrm::getRecordsByField("groupid", $_SESSION['curuser']['groupid'], "campaign"); while ($campaign_res->fetchInto($campaign)) { $campaignoption .= '<option value="' . $campaign['id'] . '">' . $campaign['campaignname'] . '</option>'; } $html .= ' ' . $locate->Translate("campaign") . ' : <select id="curCampaignid" name="curCampaignid" >' . $campaignoption . '</select>'; } // $html .= '<br>' . $locate->Translate("Dialtime") . ' : <input type="text" name="sDialtime" id="sDialtime" size="15" value="" onfocus="displayCalendar(this,\'yyyy-mm-dd hh:ii\',this,true)"> <input type="button" value="' . $locate->Translate("Add") . '" onclick="saveSchedulerDial();"> </td>'; $objResponse->addAssign("trAddSchedulerDial", "innerHTML", $html); $objResponse->addAssign("trAddSchedulerDial", "style.display", ""); } else { $objResponse->addAssign("trAddSchedulerDial", "style.display", "none"); } return $objResponse->getXML(); }
/** * save group record * @param f array group record * @return objResponse object xajax response object */ function save($f) { global $locate, $config; $objResponse = new xajaxResponse(); if (trim($f['groupname']) == '') { $objResponse->addAlert($locate->Translate("obligatory_fields")); return $objResponse->getXML(); } if (!preg_match('/^[\\d]*$/', $f['notice_interval'])) { $objResponse->addAlert($locate->Translate("notice interval must be integer")); return $objResponse->getXML(); } // if (!ereg("[0-9]+",$f['groupid'])){ // $objResponse->addAlert($locate->Translate("digit_only")); // return $objResponse->getXML(); // } $f['billingid'] = 0; if ($f['addToBilling']) { if ($config['billing']['resellerid'] > 0) { $checkreseller = astercrm::getRecordByID($config['billing']['resellerid'], 'resellergroup'); if ($checkreseller['id'] == $config['billing']['resellerid']) { $group = array(); $group['groupname'] = $f['groupname']; $group['creditlimit'] = $config['billing']['groupcreditlimit']; $group['limittype'] = $config['billing']['grouplimittype']; $group['resellerid'] = $config['billing']['resellerid']; $billingid = Customer::insertNewGroupForBilling($group); if ($billingid > 0) { $objResponse->addAlert($locate->Translate("add this group to asterbilling success")); $f['billingid'] = $billingid; } else { $objResponse->addAlert($locate->Translate("add this group to asterbilling failed")); } } else { $objResponse->addAlert($locate->Translate("Reseller id is incorrect, can not add this group to asterbilling")); } } else { $objResponse->addAlert($locate->Translate("Reseller id is incorrect, can not add this group to asterbilling")); } } $res = Customer::insertNewAccountgroup($f); // add a new account if ($res == 1) { $html = createGrid(0, ROWSXPAGE); $objResponse->addAssign("grid", "innerHTML", $html); $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("add_group")); $objResponse->addAssign("formDiv", "style.visibility", "hidden"); $objResponse->addClear("formDiv", "innerHTML"); } else { $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_insert") . ":" . $respOk->message); } return $objResponse->getXML(); }