Example #1
0
    $respondent_id = get_respondent_id($call_attempt_id);
}
if (!$case_id) {
    xhtml_head(T_("Appointment error"));
    print "<div class='alert alert-danger'>" . T_("You have not been assigned a case therefore cannot create an appointment") . "</div>";
    xhtml_foot();
    $db->CompleteTrans();
    exit;
}
if (isset($_POST['firstName']) && isset($_POST['lastName']) && isset($_POST['Time_zone_name'])) {
    //add a new respondent
    add_respondent($case_id, $_POST['firstName'], $_POST['lastName'], $_POST['Time_zone_name']);
}
if (isset($_GET['phonenum'])) {
    //add a new phone number
    add_contact_phone($case_id, $_GET['phonenum']);
}
if (isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && isset($_POST['month']) && isset($_POST['year']) && isset($_POST['respondent_id']) && isset($_POST['contact_phone_id'])) {
    //make appointment
    $day = bigintval($_POST['day']);
    $month = bigintval($_POST['month']);
    $year = bigintval($_POST['year']);
    $respondent_id = bigintval($_POST['respondent_id']);
    $contact_phone_id = bigintval($_POST['contact_phone_id']);
    $start = $_POST['start'];
    $end = $_POST['end'];
    $call_attempt_id = get_call_attempt($operator_id, false);
    $require_operator_id = false;
    if (isset($_POST['require_operator_id'])) {
        $require_operator_id = bigintval($_POST['require_operator_id']);
    }
Example #2
0
    $js_head[] = "../include/timepicker/i18n/jquery-ui-timepicker-" . $locale . ".js";
}
$js_foot = array("../js/bootstrap-confirmation.js", "../js/custom.js");
//create new or update appointment
if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['update'])) {
    $start = $db->qstr($_GET['start']);
    $end = $db->qstr($_GET['end']);
    $case_id = bigintval($_GET['case_id']);
    $respondent_id = bigintval($_GET['respondent_id']);
    $require_operator_id = "NULL";
    if ($_GET['require_operator_id'] > 1) {
        $require_operator_id = bigintval($_GET['require_operator_id']);
    }
    //* add new number to db
    if (isset($_GET['addphonenumber']) && !empty($_GET['addphonenumber'])) {
        add_contact_phone($case_id, $_GET['addphonenumber']);
        $contact_phone_id = $db->Insert_ID();
    } else {
        $contact_phone_id = bigintval($_GET['contact_phone_id']);
    }
    if (isset($_GET['new']) && $_GET['new'] == 'create') {
        $operator_id = get_operator_id();
        if ($operator_id == false) {
            die;
        }
        $sql = "SELECT Time_zone_name FROM respondent WHERE respondent_id = '{$respondent_id}'";
        $respondent_tz = $db->GetOne($sql);
        // create a call attempt
        $sql = "INSERT INTO call_attempt (call_attempt_id,case_id,operator_id,respondent_id,start,end)\r\n\t\tVALUES (NULL,{$case_id},{$operator_id},{$respondent_id},CONVERT_TZ(NOW(),@@session.time_zone,'UTC'),CONVERT_TZ(NOW(),@@session.time_zone,'UTC'))";
        $db->Execute($sql);
        $call_attempt_id = $db->Insert_ID();