From 0adf4a9d2db118b29041774123291941d9fd3ea5 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Thu, 3 Feb 2011 05:34:05 +0000 Subject: [PATCH] When assigning skills and questionnaires to operators, respect their "enabled" or "disabled" state Only display performance for enabled operators --- admin/operatorquestionnaire.php | 5 +++++ admin/operatorskill.php | 6 +++++- functions/functions.performance.php | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/admin/operatorquestionnaire.php b/admin/operatorquestionnaire.php index 60762700..07a59800 100644 --- a/admin/operatorquestionnaire.php +++ b/admin/operatorquestionnaire.php @@ -117,6 +117,10 @@ if (isset($_POST['submit'])) WHERE questionnaire_id IN ( SELECT questionnaire_id FROM questionnaire + WHERE enabled = 1) + AND operator_id IN ( + SELECT operator_id + FROM operator WHERE enabled = 1)"; $db->Execute($sql); @@ -142,6 +146,7 @@ $questionnaires = $db->GetAll($sql); $sql = "SELECT operator_id,firstname as description FROM operator + WHERE enabled = 1 ORDER by operator_id ASC"; $operators = $db->GetAll($sql); diff --git a/admin/operatorskill.php b/admin/operatorskill.php index a43a90c0..a7ae84fe 100644 --- a/admin/operatorskill.php +++ b/admin/operatorskill.php @@ -113,7 +113,10 @@ if (isset($_POST['submit'])) $sql = "DELETE FROM operator_skill - WHERE 1"; + WHERE operator_id IN ( + SELECT operator_id + FROM operator + WHERE enabled = 1)"; $db->Execute($sql); @@ -137,6 +140,7 @@ $outcome_types = $db->GetAll($sql); $sql = "SELECT operator_id,firstname as description FROM operator + WHERE enabled = 1 ORDER by operator_id ASC"; $operators = $db->GetAll($sql); diff --git a/functions/functions.performance.php b/functions/functions.performance.php index 70aeaeb9..75d09e29 100644 --- a/functions/functions.performance.php +++ b/functions/functions.performance.php @@ -70,6 +70,7 @@ function get_CPH_by_shift($qid,$sid) AND s.`start` <= a.`start` AND s.`end` >= a.`start` GROUP BY operator_id) as ca on (ca.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY cph DESC"; return $db->GetAll($sql); @@ -98,6 +99,7 @@ function get_CPH_by_questionnaire($qid) WHERE a.case_id = b.case_id AND b.questionnaire_id = '$qid' GROUP BY operator_id) as ca on (ca.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY cph DESC"; @@ -157,6 +159,7 @@ function get_stats_by_shift($questionnaire_id,$shift_id) AND s.`end` >= a.`start` AND b.questionnaire_id = '$questionnaire_id' GROUP BY a.operator_id) as calls on (calls.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY effectiveness DESC"; return $db->GetAll($sql); @@ -255,6 +258,7 @@ function get_stats() JOIN ( SELECT count(*) as calls,a.operator_id FROM `call` as a GROUP BY a.operator_id) as calls on (calls.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY effectiveness DESC"; return $db->GetAll($sql); @@ -301,6 +305,7 @@ function get_stats_by_questionnaire($questionnaire_id) WHERE a.case_id = b.case_id AND b.questionnaire_id = '$questionnaire_id' GROUP BY a.operator_id) as calls on (calls.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY effectiveness DESC"; return $db->GetAll($sql); @@ -325,6 +330,7 @@ function get_CPH() JOIN ( SELECT SUM( TIMESTAMPDIFF(SECOND , start, IFNULL(end,CONVERT_TZ(NOW(),'System','UTC')))) as time, operator_id FROM `call_attempt` GROUP BY operator_id) as ca on (ca.operator_id = o.operator_id) + WHERE o.enabled = 1 ORDER BY cph DESC"; return $db->GetAll($sql); @@ -360,6 +366,7 @@ function get_effectiveness_by_questionnaire($questionnaire_id) AND b.questionnaire_id = '$questionnaire_id' GROUP BY operator_id ) AS callattempttime ON ( callattempttime.operator_id = o.operator_id ) + WHERE o.enabled = 1 ORDER BY effectiveness DESC"; return $db->GetAll($sql); @@ -390,6 +397,7 @@ function get_effectiveness() FROM `call_attempt` AS c GROUP BY operator_id ) AS callattempttime ON ( callattempttime.operator_id = o.operator_id ) + WHERE o.enabled = 1 ORDER BY effectiveness DESC"; return $db->GetAll($sql);