diff --git a/appointment.php b/appointment.php index 71bd8b7c..4289884e 100644 --- a/appointment.php +++ b/appointment.php @@ -98,7 +98,7 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss $contact_phone_id = bigintval($_POST['contact_phone_id']); $start = $_POST['start']; $end = $_POST['end']; - $call_attempt_id = get_call_attempt($operator_id); + $call_attempt_id = get_call_attempt($operator_id,false); make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end); diff --git a/call.php b/call.php index 5d84ea66..803c72b8 100644 --- a/call.php +++ b/call.php @@ -150,9 +150,9 @@ if (isset($_POST['submit'])) if (isset($_POST['contact_phone'])) { $contact_phone_id = bigintval($_POST['contact_phone']); - $call_attempt_id = get_call_attempt($operator_id); + $call_attempt_id = get_call_attempt($operator_id,false); $respondent_id = get_respondent_id($call_attempt_id); - $call_id = get_call($operator_id,$respondent_id,$contact_phone_id); + $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); if ($call_id) { if (VOIP_ENABLED) @@ -206,7 +206,7 @@ if (isset($_POST['submit'])) exit(); } -$call_attempt_id = get_call_attempt($operator_id); +$call_attempt_id = get_call_attempt($operator_id.false); $case_id = get_case_id($operator_id); /** diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 9bc0e8bf..5a101c93 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -158,7 +158,7 @@ function get_respondent_variable($variable,$respondent_id) */ function template_replace($string,$operator_id,$case_id) { - $respondent_id = get_respondent_id(get_call_attempt($operator_id)); + $respondent_id = get_respondent_id(get_call_attempt($operator_id,false)); while (stripos($string, "{Respondent:") !== false) { @@ -239,7 +239,7 @@ function is_respondent_selection($operator_id) * @param bool $create True if a case can be created * @return bool|int False if no case available else the case_id */ -function get_case_id($operator_id, $create = true) +function get_case_id($operator_id, $create = false) { global $db; @@ -772,17 +772,18 @@ function is_on_call_attempt($operator_id) * @param int $operator_id The operator * @param string|int $respondent_id The respondent * @param string|int $contact_phone_id The number to contact the respondent on + * @param bool $create Whether or not to create a call * @return bool|int False if no call exists or can be created otherwise the call_id * */ -function get_call($operator_id,$respondent_id = "",$contact_phone_id = "") +function get_call($operator_id,$respondent_id = "",$contact_phone_id = "",$create = false) { global $db; $db->StartTrans(); $case_id = get_case_id($operator_id,false); - $ca = get_call_attempt($operator_id); + $ca = get_call_attempt($operator_id,false); $id = false; @@ -798,7 +799,7 @@ function get_call($operator_id,$respondent_id = "",$contact_phone_id = "") $row = $db->GetRow($sql); if (empty($row)) { - if (!empty($respondent_id) && !empty($contact_phone_id)) + if (!empty($respondent_id) && !empty($contact_phone_id) && $create) { $sql = "INSERT INTO `call` (call_id,operator_id,case_id,call_attempt_id,start,end,respondent_id,contact_phone_id,outcome_id,state) VALUES (NULL,'$operator_id','$case_id','$ca',CONVERT_TZ(NOW(),'System','UTC'),NULL,'$respondent_id','$contact_phone_id','0','1')"; @@ -841,7 +842,7 @@ function get_limesurvey_url($operator_id) $url = "nocaseavailable.php"; - $case_id = get_case_id($operator_id); + $case_id = get_case_id($operator_id,false); if ($case_id) { @@ -1187,7 +1188,7 @@ function get_respondent_id($call_attempt_id) * @return bool|int False if no case otherwise the call_attempt_id * */ -function get_call_attempt($operator_id,$create = true) +function get_call_attempt($operator_id,$create = false) { global $db; diff --git a/index.php b/index.php index 8a0fa5d0..b00ca42b 100644 --- a/index.php +++ b/index.php @@ -100,7 +100,7 @@ xhtml_head(T_("queXS"), true, array("css/index.css","css/tabber.css") , array("j