Ejemplo n.º 1
0
 */
include "functions/functions.operator.php";
$operator_id = get_operator_id();
$state = is_on_call($operator_id);
$js = array("js/popup.js");
if (browser_ie()) {
    $js[] = "js/window_ie6_interface2.js";
} else {
    $js[] = "js/window_interface2.js";
}
if (AUTO_LOGOUT_MINUTES !== false) {
    $js[] = "include/jquery/jquery-1.4.2.min.js";
    $js[] = "js/childnap.js";
}
xhtml_head(T_("Status"), false, array("include/bootstrap/css/bootstrap.min.css", "css/status_interface2.css"), $js);
$ca = get_call_attempt($operator_id, false);
if ($ca) {
    $respondent_id = get_respondent_id($ca);
    $case_id = get_case_id($operator_id);
    $fname = get_respondent_variable("firstName", $respondent_id);
    $lname = get_respondent_variable("lastName", $respondent_id);
    print "<h4>" . T_("Name") . ": {$fname} {$lname}</h4>";
    $appointment = is_on_appointment($ca);
    $call_id = get_call($operator_id);
    $sql = "SELECT o.tryanother, o.require_note\r\n\t\tFROM `call` as c, `outcome` as o\r\n\t\tWHERE c.call_attempt_id = '{$ca}'\r\n\t\tAND c.outcome_id = o.outcome_id\r\n\t\tORDER BY call_id DESC\r\n\t\tLIMIT 1";
    $rst = $db->GetRow($sql);
    if (empty($rst) || $rst['tryanother'] == 1) {
        if (isset($_POST['contactphone'])) {
            $pcontact_phone_id = intval($_POST['contactphone']);
            //If an outcome already assigned, end the current call and start the enxt one to pcontact_phone_id
            //Otherwise bring up the assign outcome window
Ejemplo n.º 2
0
 * Input functions
 */
include "functions/functions.input.php";
/**
 * LimeSurvey functions
 */
include "functions/functions.limesurvey.php";
global $db;
$operator_id = get_operator_id();
$msg = "";
if (isset($_POST['email']) && (isset($_POST['firstname']) && !empty($_POST['firstname']) || isset($_POST['lastname']) && !empty($_POST['lastname']))) {
    //validate email address
    if (validate_email($_POST['email'])) {
        $case_id = get_case_id($operator_id);
        $lime_sid = get_lime_sid($case_id);
        $ca = get_call_attempt($operator_id);
        $token = get_token($case_id);
        $email = $db->qstr($_POST['email']);
        $firstname = $db->qstr($_POST['firstname']);
        $lastname = $db->qstr($_POST['lastname']);
        //update the limesurvey database email details
        $sql = "UPDATE " . LIME_PREFIX . "tokens_{$lime_sid}\r\n\t\t\tSET email = {$email}, firstname = {$firstname}, lastname = {$lastname}, emailstatus = 'OK'\r\n\t\t\tWHERE token = '{$token}'";
        $db->Execute($sql);
        //Send email
        include_once "include/limesurvey/classes/phpmailer/class.phpmailer.php";
        $fieldsarray = array();
        $fieldsarray["{EMAIL}"] = $_POST['email'];
        $fieldsarray["{FIRSTNAME}"] = $_POST['firstname'];
        $fieldsarray["{LASTNAME}"] = $_POST['lastname'];
        $fieldsarray["{TOKEN}"] = $token;
        $fieldsarray["{LANGUAGE}"] = DEFAULT_LOCALE;
Ejemplo n.º 3
0
			<?php 
}
?>

			</div>
			
		</div>	

	</div>


	
	<div class="row"> 

		<?php 
$ca = get_call_attempt($operator_id, true);
$call_id = get_call($operator_id);
$appointment = false;
if ($ca) {
    $appointment = is_on_appointment($ca);
    $respondent_id = get_respondent_id($ca);
}
if (!$call_id) {
    if ($appointment) {
        //create a call on the appointment number
        $sql = "SELECT cp.*, a.respondent_id\r\n\t\t\t\t\t\tFROM contact_phone as cp, appointment as a\r\n\t\t\t\t\t\tWHERE cp.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND a.appointment_id = '{$appointment}'\r\n\t\t\t\t\t\tAND a.contact_phone_id = cp.contact_phone_id";
    } else {
        //create a call on the first available number by priority
        $sql = "SELECT c. *\r\n\t\t\t\t\t\tFROM contact_phone AS c\r\n\t\t\t\t\t\tLEFT JOIN (\r\n\t\t\t\t\t\t\t\tSELECT contact_phone.contact_phone_id\r\n\t\t\t\t\t\t\t\tFROM contact_phone\r\n\t\t\t\t\t\t\t\tLEFT JOIN `call` ON ( call.contact_phone_id = contact_phone.contact_phone_id )\r\n\t\t\t\t\t\t\t\tLEFT JOIN outcome ON ( call.outcome_id = outcome.outcome_id )\r\n\t\t\t\t\t\t\t\tWHERE contact_phone.case_id = '{$case_id}'\r\n\t\t\t\t\t\t\t\tAND outcome.tryagain =0\r\n\t\t\t\t\t\t\t  ) AS l ON l.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tLEFT JOIN\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t SELECT contact_phone_id\r\n\t\t\t\t\t\t FROM `call`\r\n\t\t\t\t\t\t WHERE call_attempt_id = '{$ca}'\r\n\t\t\t\t\t\t AND outcome_id NOT IN (15,18)\r\n\t\t\t\t\t\t) as ca on ca.contact_phone_id = c.contact_phone_id\r\n\t\t\t\t\t\tWHERE c.case_id = '{$case_id}'\r\n\t\t\t\t\t\tAND l.contact_phone_id IS NULL\r\n\t\t\t\t\t\tAND ca.contact_phone_id IS NULL\r\n\t\t\t\t\t\torder by c.priority ASC";
    }
    $rs = $db->GetRow($sql);
Ejemplo n.º 4
0
/**
 * End the current call
 * Store the time and outcome in the database
 *
 * @param int $operator_id The operator
 * @param int $outcome_id The outcome to the call
 * @param int $state The end state of the call 5 default
 * @return bool True if database execution succeeded
 *
 * @todo Implement session destruction here
 *
 */
function end_call($operator_id, $outcome_id, $state = 5)
{
    global $db;
    $db->StartTrans();
    $o = false;
    $ca = get_call($operator_id);
    if ($ca) {
        $c = get_call_attempt($operator_id, false);
        if ($c) {
            $a = is_on_appointment($c);
            //if we were on an appointment, complete it with this call
            if ($a) {
                $sql = "UPDATE appointment\r\n\t\t\t\t\tSET completed_call_id = '{$ca}'\r\n\t\t\t\t\tWHERE appointment_id = '{$a}'";
                $db->Execute($sql);
            }
        }
        $sql = "UPDATE `call`\r\n\t\t\tSET end = CONVERT_TZ(NOW(),'System','UTC'), outcome_id = '{$outcome_id}', state = '{$state}'\r\n\t\t\tWHERE call_id = '{$ca}'";
        $db->Execute($sql);
    }
    //if ($db->HasFailedTrans()) { print "FAILED in end_call"; exit; }
    if ($db->CompleteTrans()) {
        return $o;
    }
    return false;
}