From 5c0fa55d2941390fcddfbb6824d57fee6802949c Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Tue, 2 Jun 2015 12:24:24 +1000 Subject: [PATCH] Bug Fix: lp:1459935 When no operators have an extension assigned, questionnaires in test mode fail to create phone numbers for new cases --- functions/functions.operator.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 1b223c5c..ecec5328 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -367,10 +367,10 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = $db->Execute("SET @row := 0"); $sql = "INSERT INTO contact_phone (case_id,priority,phone,description) - SELECT $case_id as case_id,@row := @row + 1 AS priority,SUBSTRING_INDEX(e.extension,'/',-1) as phone, CONCAT(o.firstName, ' ', o.lastName) - FROM operator as o, `extension` as e - WHERE o.enabled = 1 - AND e.current_operator_id = o.operator_id"; + SELECT $case_id as case_id,@row := @row + 1 AS priority,IFNULL(SUBSTRING_INDEX(e.extension,'/',-1),'312345678') as phone, CONCAT(o.firstName, ' ', o.lastName) + FROM operator as o + LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id) + WHERE o.enabled = 1"; $db->Execute($sql); }