Esempio n. 1
0
function addNote()
{
    $response = array('action' => 'addNote', 'message' => 'Lưu nội dung cuộc gọi thành công');
    // collect parameters
    $sNote = trim(getParameter('note'));
    $sCallid = trim(getParameter('callid'));
    if ($sCallid == '' || is_null($sCallid) || $sNote == '') {
        $response['action'] = 'error';
        $response['message'] = 'Lưu nội dung cuộc gọi: không có cuộc gọi hoặc không có nội dung!';
        $json = new Services_JSON();
        Header('Content-Type: application/json');
        return $json->encode($response);
    }
    global $arrConf;
    $oCustomer = new getInfoMainConsole();
    $oCustomer->callcenter_db_connect($arrConf['cadena_dsn']);
    $result = $oCustomer->addNote($sCallid, $sNote);
    $oCustomer->callcenter_db_disconnect();
    // return json
    if (!$result) {
        $response['action'] = 'error';
        $response['message'] = 'Lỗi: ' . $oCustomer->errMsg;
    }
    $json = new Services_JSON();
    Header('Content-Type: application/json');
    return $json->encode($response);
}