From c64c71e4284f018d05c202bd3e8c8c79e9d47cab Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Mon, 14 Jul 2014 12:03:29 +1000 Subject: [PATCH] Fixed Bug: Notices generated when running index_update.php --- index_interface2.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/index_interface2.php b/index_interface2.php index ff582265..23d0a913 100644 --- a/index_interface2.php +++ b/index_interface2.php @@ -45,12 +45,15 @@ include ("functions/functions.xhtml.php"); */ include("functions/functions.operator.php"); -$db->StartTrans(); $popupcall = false; $operator_id = get_operator_id(); +if ($operator_id === false) die(); + +$db->StartTrans(); + if (isset($_GET['endwork'])) { $call_id = get_call($operator_id); @@ -235,7 +238,7 @@ if (!$call_id) if ($appointment) { //create a call on the appointment number - $sql = "SELECT cp.* + $sql = "SELECT cp.*, a.respondent_id FROM contact_phone as cp, appointment as a WHERE cp.case_id = '$case_id' AND a.appointment_id = '$appointment' @@ -274,6 +277,19 @@ if (!$call_id) { $contact_phone_id = $rs['contact_phone_id']; + if (!isset($rs['respondent_id'])) + { + $sql = "SELECT respondent_id + FROM respondent + WHERE case_id = $case_id"; + + $respondent_id = $db->GetOne($sql); + } + else + { + $respondent_id = $rs['respondent_id']; + } + $call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true); } }