From 2bbe9ea06a6572d750444f9712bd566761721830 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Mon, 25 Nov 2013 16:31:08 +1100 Subject: [PATCH] Only allow extension changes when not on a case --- admin/operatorlist.php | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/admin/operatorlist.php b/admin/operatorlist.php index d337dedf..b74ad0c7 100644 --- a/admin/operatorlist.php +++ b/admin/operatorlist.php @@ -75,18 +75,29 @@ if (isset($_POST['submit'])) if (!empty($rs)) { - $sql = "UPDATE extension - SET current_operator_id = NULL - WHERE current_operator_id= $operator_id"; - $db->Execute($sql); + //only update extension if we aren't on a case + $sql = "SELECT case_id + FROM `case` + WHERE current_operator_id = $operator_id"; - if (!empty($_POST['extension_id'])) + $cc= $db->GetOne($sql); + + if (empty($cc)) { $sql = "UPDATE extension - SET current_operator_id = $operator_id - WHERE extension_id = " . intval($_POST['extension_id']); + SET current_operator_id = NULL + WHERE current_operator_id= $operator_id"; $db->Execute($sql); + + if (!empty($_POST['extension_id'])) + { + $sql = "UPDATE extension + SET current_operator_id = $operator_id + WHERE extension_id = " . intval($_POST['extension_id']); + + $db->Execute($sql); + } } if (HTPASSWD_PATH !== false && !empty($_POST['password']))