Exemple #1
0
/**
*  generate account add form HTML code
*  @return	html		string		account add HTML code
*/
function add()
{
    // Edit zone
    global $locate;
    $objResponse = new xajaxResponse();
    $html = Table::Top($locate->Translate("adding_agents"), "formDiv");
    // <-- Set the title for your form.
    $html .= Customer::formAdd();
    // <-- Change by your method
    // End edit zone
    $html .= Table::Footer();
    $objResponse->addAssign("formDiv", "style.visibility", "visible");
    $objResponse->addAssign("formDiv", "innerHTML", $html);
    return $objResponse->getXML();
}
Exemple #2
0
function getContact($callerid, $customer_id = 0, $campaignid = 0, $diallistid = 0, $srcname = null)
{
    global $db, $locate, $config;
    $mycallerid = $callerid;
    $objResponse = new xajaxResponse();
    if ($callerid == '') {
        $objResponse->addALert($locate->Translate('Caller number cannot be empty'));
        return $objResponse;
    }
    $objResponse->addAssign("iptCallerid", "value", $callerid);
    if ($config['system']['trim_prefix'] != '') {
        $prefix = split(",", $config['system']['trim_prefix']);
        foreach ($prefix as $myprefix) {
            if (substr($mycallerid, 0, 1) == $myprefix) {
                $mycallerid = substr($mycallerid, 1);
                break;
            }
        }
    }
    //check contact table first
    if ($config['system']['enable_contact'] == '0' && $customer_id == '') {
        if ($config['system']['detail_level'] == 'all') {
            $row = astercrm::getContactByCallerid($mycallerid);
        } else {
            $row = astercrm::getContactByCallerid($mycallerid, $_SESSION['curuser']['groupid']);
        }
    }
    if ($row['id'] == '' || $config['system']['enable_contact'] == '0') {
        //no match
        //	print 'no match in contact list';
        //try get customer
        if ($config['system']['detail_level'] == 'all') {
            $customerid = astercrm::getCustomerByCallerid($mycallerid);
        } else {
            $customerid = astercrm::getCustomerByCallerid($mycallerid, $_SESSION['curuser']['groupid']);
        }
        if ($customerid == '') {
            //$objResponse->addScript('xajax_add(\'' . $callerid . '\');');
            if ($config['system']['enable_formadd_popup']) {
                $html = Table::Top($locate->Translate("add_record"), "formDiv");
                // <-- Set the
                $html .= Customer::formAdd($callerid, 0, 0, $campaignid, $diallistid, '', $srcname);
                $html .= Table::Footer();
                $objResponse->addAssign("formDiv", "style.visibility", "visible");
                $objResponse->addAssign("formDiv", "innerHTML", $html);
            }
            // callerid smart match
            if ($config['system']['smart_match_remove']) {
                if ($config['system']['detail_level'] == 'all') {
                    $contact_res = astercrm::getContactSmartMatch($mycallerid);
                    $customer_res = astercrm::getCustomerSmartMatch($mycallerid);
                } else {
                    $contact_res = astercrm::getContactSmartMatch($mycallerid, $_SESSION['curuser']['groupid']);
                    $customer_res = astercrm::getCustomerSmartMatch($mycallerid, $_SESSION['curuser']['groupid']);
                }
                $smartcount = 0;
                while ($customer_res->fetchInto($row)) {
                    $smartcount++;
                    $smartmatch_html .= '<a href="###" onclick="xajax_showCustomer(\'' . $row['id'] . '\',\'customer\',' . $callerid . ');showMsgBySmartMatch(\'customer\',\'' . $row['customer'] . '\');">' . $locate->Translate("customer") . ':&nbsp;' . $row['customer'] . '<br>' . $locate->Translate("phone") . ':' . $row['phone'] . '</a><hr>';
                }
                while ($contact_res->fetchInto($row)) {
                    $smartcount++;
                    $smartmatch_html .= '<a href="###" onclick="xajax_showContact(\'' . $row['id'] . '\');showMsgBySmartMatch(\'contact\',\'' . $row['contact'] . '\');">' . $locate->Translate("contact") . ':&nbsp;' . $row['contact'] . '<br>' . $locate->Translate("phone") . ':' . $row['phone'] . '&nbsp;&nbsp;' . $row['phone1'] . '&nbsp;&nbsp;' . $row['phone2'] . '</a><hr>';
                }
                if ($smartcount < 3) {
                    $objResponse->addAssign("smartMsgDiv", "style.height", '');
                    $objResponse->addAssign("SmartMatchDiv", "style.height", '');
                } else {
                    $objResponse->addAssign("smartMsgDiv", "style.height", '160px');
                    $objResponse->addAssign("SmartMatchDiv", "style.height", '240px');
                }
                if ($smartcount) {
                    $objResponse->addAssign("smartMsgDiv", "innerHTML", $smartmatch_html);
                    $objResponse->addScript('getSmartMatchMsg();');
                }
            }
        } else {
            if ($config['system']['enable_formadd_popup']) {
                $html = Table::Top($locate->Translate("add_record"), "formDiv");
                // <-- Set the title for your form.
                $html .= Customer::formAdd($callerid, $customerid, 0, $campaignid, $diallistid, '', $srcname);
                // <-- Change by your method
                $html .= Table::Footer();
                $objResponse->addAssign("formDiv", "style.visibility", "visible");
                $objResponse->addAssign("formDiv", "innerHTML", $html);
            }
            $objResponse->addScript('xajax_showCustomer(\'' . $customerid . '\',\'customer\',' . $callerid . ');');
            if ($config['system']['auto_note_popup']) {
                $objResponse->addScript('xajax_showNote(\'' . $customerid . '\',\'customer\');');
            }
        }
    } else {
        // one match
        if ($customer_id == '') {
            $customerid = $row['customerid'];
        } else {
            $customerid = $customer_id;
        }
        $contactid = $row['id'];
        if ($config['system']['enable_formadd_popup']) {
            $html = Table::Top($locate->Translate("add_record"), "formDiv");
            // <-- Set the title for your form.
            $html .= Customer::formAdd($callerid, $customerid, $contactid, $campaignid, $diallistid);
            // <-- Change by your method
            $html .= Table::Footer();
            $objResponse->addAssign("formDiv", "style.visibility", "visible");
            $objResponse->addAssign("formDiv", "innerHTML", $html);
        }
        $objResponse->addScript('xajax_showContact(\'' . $contactid . '\');');
        if ($customerid != 0) {
            $objResponse->addScript('xajax_showCustomer(\'' . $customerid . '\',\'customer\',' . $callerid . ');');
            if ($config['system']['auto_note_popup']) {
                $objResponse->addScript('xajax_showNote(\'' . $customerid . '\',\'customer\');');
            }
        } else {
            if ($config['system']['auto_note_popup']) {
                $objResponse->addScript('xajax_showNote(\'' . $contactid . '\',\'contact\');');
            }
        }
    }
    //echo $campaignid.$diallistid;exit;
    return $objResponse;
}
Exemple #3
0
function add()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $html = Table::Top($locate->Translate("add_diallist"), "formDiv");
    $html .= Customer::formAdd();
    $html .= Table::Footer();
    $objResponse->addAssign("formDiv", "style.visibility", "visible");
    $objResponse->addAssign("formDiv", "innerHTML", $html);
    //增加读取campaign的js函数
    $objResponse->addScript("setCampaign();");
    return $objResponse->getXML();
}
Exemple #4
0
function add($surveyid = 0)
{
    global $locate;
    $objResponse = new xajaxResponse();
    $html = Table::Top($locate->Translate("add_survey"), "formDiv");
    $html .= Customer::formAdd($surveyid);
    $html .= Table::Footer();
    $objResponse->addAssign("formDiv", "style.visibility", "visible");
    $objResponse->addAssign("formDiv", "innerHTML", $html);
    if ($surveyid == 0) {
        $objResponse->addScript("xajax.\$('surveyname').focus();");
    } else {
        $objResponse->addScript("xajax.\$('surveyoption').focus();");
    }
    return $objResponse->getXML();
}
function add($callerid = null, $customerid = null, $contactid = null, $campaignid = 0, $note = '')
{
    global $locate;
    $objResponse = new xajaxResponse();
    //	return $objResponse;
    $html = Table::Top($locate->Translate("add_record"), "formDiv");
    // <-- Set the title for your form.
    //	$html .= Customer::formAdd($callerid,$customerid,$contactid);  // <-- Change by your method
    $html .= Customer::formAdd($callerid, $customerid, $contactid, $campaignid, $dialedid, $note);
    //	$objResponse->addAlert($callerid);
    // End edit zone
    $html .= Table::Footer();
    $objResponse->addAssign("formDiv", "style.visibility", "visible");
    $objResponse->addAssign("formDiv", "innerHTML", $html);
    return $objResponse->getXML();
}
function add()
{
    global $locate;
    $objResponse = new xajaxResponse();
    $html = Table::Top($locate->Translate("adding_ticketdetails"), "formDiv");
    // <-- Set the title for your form.
    $html .= Customer::formAdd();
    // <-- Change by your method
    $html .= Table::Footer();
    $objResponse->addAssign("formDiv", "style.visibility", "visible");
    $objResponse->addAssign("formDiv", "innerHTML", $html);
    $objResponse->addScript("relateBycategoryID(document.getElementById('ticketcategoryid').value)");
    return $objResponse->getXML();
}