예제 #1
0
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") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'astercrm_account');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $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") {
        $arreglo =& Customer::getAllRecords($start, $limit, $order, $_SESSION['curuser']['groupid']);
        $content = '';
        foreach ($arreglo as $agents) {
            if ($agents['agent'] == $id) {
                continue;
            } else {
                $addstr = "\nagent => " . trim($agents['agent']) . ',' . trim($agents['password']) . ',' . trim($agents['name']);
            }
            $content .= $addstr;
        }
        $agentsfile = '/etc/asterisk/agents_astercc.conf';
        if ($fhandle = fopen($agentsfile, 'w')) {
            fwrite($fhandle, $content);
            $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();
}
예제 #2
0
function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'accountgroup');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($type == "delete") {
        if ($config['synchronize']['delete_by_use_history']) {
            $res = Customer::deleteRecordToHistory('groupid', $id, 'clid');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'myrate');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'callshoprate');
            $res = Customer::deleteRecordToHistory('groupid', $id, 'account');
            $res = Customer::deleteRecordToHistory('id', $id, 'accountgroup');
        } else {
            $res = Customer::deleteRecords('groupid', $id, 'clid');
            $res = Customer::deleteRecords('groupid', $id, 'myrate');
            $res = Customer::deleteRecords('groupid', $id, 'callshoprate');
            $res = Customer::deleteRecords('groupid', $id, 'account');
            $res = Customer::deleteRecord($id, 'accountgroup');
        }
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType);
            $objResponse = new xajaxResponse();
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
            $objResponse->addClear("msgZone", "innerHTML");
            $objResponse->addAssign($divName, "innerHTML", $html);
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
예제 #3
0
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") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'worktimes');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($type == "delete") {
        $row = Customer::getRecordByField('worktime_id', $id, 'worktimepackage_worktimes');
        if ($row['id'] != '') {
            $objResponse->addAlert($locate->Translate("this worktime in one or more package, can not delete"));
            return $objResponse->getXML();
        }
        $res = Customer::deleteRecord($id, 'worktimes');
        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();
}
예제 #4
0
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, 'sms_sents');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addAssign("maintable", "value", 'sms_sents');
        //赋值隐含域
        $objResponse->addAssign("exporttype", "value", $optionFlag);
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($optionFlag == "delete") {
        astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'sms_sents');
        $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, '');
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } elseif ($type == "delete") {
        $res = Customer::deleteRecord($id, 'sms_templates');
        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();
}
예제 #5
0
function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null)
{
    global $locate, $db;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $exportFlag = $searchFormValue['exportFlag'];
    $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, 'diallist');
        //得到要导出的sql语句
        $joinstr = astercrm::createSqlWithStype($searchField, $searchContent, $searchType, 'diallist');
        $joinstr = ltrim($joinstr, 'AND');
        $sql = "SELECT diallist.dialnumber, customer.customer,diallist.customername,diallist.dialtime, diallist.assign,diallist.status,groupname,campaignname,diallist.cretime,diallist.creby,diallist.memo FROM diallist LEFT JOIN astercrm_accountgroup ON astercrm_accountgroup.groupid = diallist.groupid LEFT JOIN campaign ON campaign.id = diallist.campaignid  LEFT JOIN customer ON customer.id = diallist.customerid";
        if ($joinstr != '') {
            $sql .= " WHERE " . $joinstr;
        }
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addAssign("maintable", "value", 'diallist');
        //赋值隐含域
        $objResponse->addAssign("exporttype", "value", $optionFlag);
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($optionFlag == "delete") {
        astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'diallist');
        $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', $order, $divName, $ordering, '');
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } else {
        if ($type == "delete") {
            $res = Customer::deleteRecord($id, 'diallist');
            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"));
            } 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();
}
예제 #6
0
function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $deleteFlag = $searchFormValue['deleteFlag'];
    $exportFlag = $searchFormValue['exportFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($exportFlag == "1" || $optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'curcdr');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($deleteFlag == "1" || $optionFlag == "delete") {
        Customer::deleteFromSearch($searchContent, $searchField, $searchType, 'curcdr');
        $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', '', $divName, "", 1, $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } else {
        if ($type == "delete") {
            $res = Customer::deleteRecord($id, 'curcdr');
            if ($res) {
                $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", 1, $searchType);
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record deleted"));
            } else {
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record cannot be deleted"));
            }
        } else {
            $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", 1, $searchType);
        }
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
예제 #7
0
파일: cdr.server.php 프로젝트: ljhcj/IRISCC
function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $searchType = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $exportFlag = $searchFormValue['exportFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    $allOrAnswer = $searchFormValue['allOrAnswer'];
    #选中的radio值
    if ($exportFlag == "1" || $optionFlag == "export") {
        if ($config['system']['useHistoryCdr'] == 1) {
            $table = 'historycdr';
        } else {
            $table = 'mycdr';
        }
        if ($searchFormValue['allOrAnswer'] == 'answered') {
            $searchContent[] = '0';
            $searchField[] = 'billsec';
            $searchType[] = 'more';
        }
        if ($_SESSION['curuser']['usertype'] == 'admin' || $_SESSION['curuser']['usertype'] == 'reseller') {
            $fieldArray = array('id', 'calldate', 'src', 'dst', 'srcname', 'channel', 'dstchannel', 'didnumber', 'duration', 'billsec', 'billsec_leg_a', 'disposition', 'accountcode', 'userfield', 'srcuid', 'dstuid', 'queue', 'calltype', 'credit', 'callshopcredit', 'resellercredit', 'groupid', 'resellerid', 'userid', 'accountid', 'destination', 'monitored', 'memo', 'dialstring', 'dialstatus', 'children', 'ischild', 'processed', 'customerid', 'crm_customerid', 'contactid', 'discount', 'payment', 'note', 'setfreecall', 'astercrm_groupid', 'hangupcause', 'hangupcausetxt');
        } else {
            if ($_SESSION['curuser']['usertype'] == 'groupadmin') {
                $fieldArray = array('id', 'calldate', 'src', 'dst', 'srcname', 'channel', 'dstchannel', 'didnumber', 'duration', 'billsec', 'billsec_leg_a', 'disposition', 'accountcode', 'userfield', 'srcuid', 'dstuid', 'queue', 'calltype', 'credit', 'callshopcredit', 'groupid', 'resellerid', 'userid', 'accountid', 'destination', 'monitored', 'memo', 'dialstring', 'dialstatus', 'children', 'ischild', 'processed', 'customerid', 'crm_customerid', 'contactid', 'discount', 'payment', 'note', 'setfreecall', 'astercrm_groupid', 'hangupcause', 'hangupcausetxt');
            } else {
                if ($_SESSION['curuser']['usertype'] == 'operator' && $_SESSION['curuser']['usertype'] == 'clid') {
                    $fieldArray = array('id', 'calldate', 'src', 'dst', 'srcname', 'channel', 'dstchannel', 'didnumber', 'duration', 'billsec', 'billsec_leg_a', 'disposition', 'accountcode', 'userfield', 'srcuid', 'dstuid', 'queue', 'calltype', 'credit', 'groupid', 'resellerid', 'userid', 'accountid', 'destination', 'monitored', 'memo', 'dialstring', 'dialstatus', 'children', 'ischild', 'processed', 'customerid', 'crm_customerid', 'contactid', 'discount', 'payment', 'note', 'setfreecall', 'astercrm_groupid', 'hangupcause', 'hangupcausetxt');
                }
            }
        }
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, $table, implode(',', $fieldArray));
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
        return $objResponse->getXML();
    } elseif ($optionFlag == "delete") {
        if ($config['system']['useHistoryCdr'] == 1) {
            $table = 'historycdr';
        } else {
            $table = 'mycdr';
        }
        if ($searchFormValue['allOrAnswer'] == 'answered') {
            $searchContent[] = '0';
            $searchField[] = 'billsec';
            $searchType[] = 'more';
        }
        astercrm::deletefromsearch($searchContent, $searchField, $searchType, $table);
        $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', '', $divName, "", $searchType, '', $allOrAnswer);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } elseif ($type == "delete") {
        $res = '';
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType, '', $allOrAnswer);
            $objResponse = new xajaxResponse();
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField[count($searchField) - 1], $divName, "", $searchType, '', $allOrAnswer);
    }
    $objResponse->addClear("msgZone", "innerHTML");
    $objResponse->addAssign($divName, "innerHTML", $html);
    return $objResponse->getXML();
}
예제 #8
0
function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'clid');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($optionFlag == "delete") {
        if (empty($_SESSION['curuser']['usertype'])) {
            $objResponse->addAlert($locate->Translate("Session time out,please try again"));
            return $objResponse->getXML();
        }
        if ($_SESSION['curuser']['usertype'] == 'groupadmin') {
            $searchContent[] = $_SESSION['curuser']['groupid'];
            $searchField[] = 'groupid';
            $searchType[] = 'equal';
        } elseif ($_SESSION['curuser']['usertype'] == 'reseller') {
            $searchContent[] = $_SESSION['curuser']['resellerid'];
            $searchField[] = 'resellerid';
            $searchType[] = 'equal';
        }
        if ($config['synchronize']['delete_by_use_history']) {
            astercrm::deleteToHistoryFromSearch($searchContent, $searchField, $searchType, 'clid');
        } else {
            astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'clid');
        }
        $html = createGrid($numRows, $limit, '', '', '', $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } elseif ($type == "delete") {
        if (empty($_SESSION['curuser']['usertype'])) {
            $objResponse->addAlert($locate->Translate("Session time out,please try again"));
            return $objResponse->getXML();
        }
        if ($config['synchronize']['delete_by_use_history']) {
            $res = Customer::deleteRecordToHistory('id', $id, 'clid');
        } else {
            $res = Customer::deleteRecord($id, 'clid');
        }
        if ($res) {
            $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", $searchType);
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record deleted"));
            $objResponse->addAssign($divName, "innerHTML", $html);
        } else {
            $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record cannot be deleted"));
        }
    } else {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
예제 #9
0
파일: cdr.server.php 프로젝트: ljhcj/IRISCC
function searchFormSubmit($searchFormValue, $numRows = null, $limit = null, $id = null, $type = null, $order = '')
{
    global $locate, $db;
    #print_r($searchFormValue);exit;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $searchType = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $ordering = $searchFormValue['ordering'];
    $order = $searchFormValue['order'];
    $divName = "grid";
    $allOrAnswer = $searchFormValue['allOrAnswer'];
    #选中的radio值
    if ($optionFlag == "export" || $optionFlag == "exportcsv") {
        $fieldArray = array('mycdr.*', 'astercrm_accountgroup.groupname', 'astercrm_account.username');
        $leftjoinArray = array('astercrm_accountgroup' => array('astercrm_accountgroup.id', 'mycdr.astercrm_groupid'), 'astercrm_account' => array('astercrm_account.id', 'mycdr.accountid'));
        if ($searchFormValue['allOrAnswer'] == 'answered') {
            $searchContent[] = '0';
            $searchField[] = 'billsec';
            $searchType[] = 'more';
        }
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'mycdr', $fieldArray, $leftjoinArray);
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addAssign("exporttype", "value", $optionFlag);
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } else {
        if ($type == "delete") {
            $res = Customer::deleteRecord($id, 'account');
            if ($res) {
                $html = createGrid('', '', $searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $order, $divName, $ordering, $searchType, $allOrAnswer);
                $objResponse = new xajaxResponse();
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("delete_rec"));
            } else {
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("rec_cannot_delete"));
            }
        } else {
            $html .= createGrid('', '', $numRows, $limit, $searchField, $searchContent, $order, $divName, $ordering, $searchType, $allOrAnswer);
        }
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}
예제 #10
0
function searchFormSubmit($searchFormValue, $numRows, $limit, $id, $type)
{
    global $locate, $db, $config;
    $objResponse = new xajaxResponse();
    $searchField = array();
    $searchContent = array();
    $optionFlag = $searchFormValue['optionFlag'];
    $deleteFlag = $searchFormValue['deleteFlag'];
    $exportFlag = $searchFormValue['exportFlag'];
    $searchContent = $searchFormValue['searchContent'];
    //搜索内容 数组
    $searchField = $searchFormValue['searchField'];
    //搜索条件 数组
    $searchType = $searchFormValue['searchType'];
    //搜索方式 数组
    $divName = "grid";
    if ($exportFlag == "1" || $optionFlag == "export") {
        $sql = astercrm::getSql($searchContent, $searchField, $searchType, 'resellerrate');
        //得到要导出的sql语句
        $_SESSION['export_sql'] = $sql;
        $objResponse->addAssign("hidSql", "value", $sql);
        //赋值隐含域
        $objResponse->addScript("document.getElementById('exportForm').submit();");
    } elseif ($deleteFlag == "1" || $optionFlag == "delete") {
        if (empty($_SESSION['curuser']['usertype'])) {
            $objResponse->addAlert($locate->Translate("Session time out,please try again"));
            return $objResponse->getXML();
        }
        if ($config['synchronize']['delete_by_use_history']) {
            astercrm::deleteToHistoryFromSearch($searchContent, $searchField, $searchType, 'resellerrate');
        } else {
            astercrm::deletefromsearch($searchContent, $searchField, $searchType, 'resellerrate');
        }
        $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], '', '', '', $divName, "", 1, $searchType);
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    } elseif ($optionFlag == "multiEdit") {
        $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", 1, 1, $searchType);
        $showMutiEdit = Table::Top($locate->Translate("Multi Edit"), "formDiv");
        $showMutiEdit .= astercrm::formMutiEdit($searchContent, $searchField, $searchType, 'resellerrate');
        $showMutiEdit .= Table::Footer();
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
        $objResponse->addAssign('formDiv', "innerHTML", $showMutiEdit);
        $objResponse->addAssign('formDiv', "style.visibility", 'visible');
    } else {
        if ($type == "delete") {
            if (empty($_SESSION['curuser']['usertype'])) {
                $objResponse->addAlert($locate->Translate("Session time out,please try again"));
                return $objResponse->getXML();
            }
            if ($config['synchronize']['delete_by_use_history']) {
                $res = Customer::deleteRecordToHistory('id', $id, 'resellerrate');
            } else {
                $res = Customer::deleteRecord($id, 'resellerrate');
            }
            if ($res) {
                $html = createGrid($searchFormValue['numRows'], $searchFormValue['limit'], $searchField, $searchContent, $searchField, $divName, "", 1, $searchType);
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record deleted"));
            } else {
                $objResponse->addAssign("msgZone", "innerHTML", $locate->Translate("record cannot be deleted"));
            }
        } else {
            $html = createGrid($numRows, $limit, $searchField, $searchContent, $searchField, $divName, "", 1, $searchType);
        }
        $objResponse->addClear("msgZone", "innerHTML");
        $objResponse->addAssign($divName, "innerHTML", $html);
    }
    return $objResponse->getXML();
}