From eff3a27a2564469328eb32d701b000193119de4a Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 18 Nov 2015 21:58:17 +0300 Subject: [PATCH] simplified code, adjusted for customized_outcomes --- call.php | 23 +++++++++-------------- call_interface2.php | 36 ++++++++++++------------------------ 2 files changed, 21 insertions(+), 38 deletions(-) diff --git a/call.php b/call.php index 72b52897..0e871cd2 100644 --- a/call.php +++ b/call.php @@ -120,24 +120,19 @@ function display_outcomes($contacted,$ca,$case_id) } else { - if ($contacted === false) - { - $sql = "SELECT outcome_id,description - FROM outcome - WHERE outcome_id != 10 - AND outcome_id IN ($outcomes)"; //don't show completed if not - } + if ($contacted === false) $ctd = ""; else { $contacted = bigintval($contacted); - - $sql = "SELECT outcome_id,description - FROM outcome - WHERE contacted = '$contacted' - AND outcome_id != 10 - AND outcome_id IN ($outcomes)"; //don't show completed if not + $ctd = "AND contacted = '$contacted'"; } - + + $sql = "SELECT outcome_id,description + FROM outcome + WHERE outcome_type_id != '5' + $ctd + AND outcome_id IN ($outcomes) + AND outcome_id NOT IN(10,42,43,44,45)"; //don't show completed if not, hide max calls as the supposed to be automatic or admin } } $rs = $db->GetAll($sql); diff --git a/call_interface2.php b/call_interface2.php index 8b0e627f..6089efdc 100644 --- a/call_interface2.php +++ b/call_interface2.php @@ -114,35 +114,25 @@ function display_outcomes($contacted,$ca,$case_id) //we have an appointment made ... only select appointment ID's $sql = "SELECT outcome_id,description,contacted FROM outcome - WHERE outcome_id = '19'"; //outcome_type_id = '5' + WHERE outcome_type_id = '5' + AND outcome_id IN ($outcomes)"; } else { - if ($contacted === false) - { - print "
".T_("CONTACTED").""; - print "".T_("NOT CONTACTED")."
"; - - if (isset ($_GET['contacted'])){ - - $contacted = bigintval($_GET['contacted']); - + print "
".T_("CONTACTED").""; + print "".T_("NOT CONTACTED")."
"; + + if (isset ($_GET['contacted'])) $contacted = bigintval($_GET['contacted']); + else if ($contacted) $contacted = bigintval($contacted); + + if ($contacted || $contacted === 0 ){ + $sql = "SELECT outcome_id,description,contacted FROM outcome WHERE contacted = '$contacted' + AND outcome_type_id != '5' AND outcome_id IN ($outcomes) - AND outcome_id NOT IN(5,10,19,21,40,41,42,43,44,45)"; - } - } - else - { - $contacted = bigintval($contacted); - - $sql = "SELECT outcome_id,description,contacted - FROM outcome - WHERE contacted = '$contacted' - AND outcome_id IN ($outcomes) - AND outcome_id NOT IN(5,10,19,21,40,41,42,43,44,45)"; + AND outcome_id NOT IN(10,42,43,44,45)"; //don't show completed if not, hide max calls as the supposed to be automatic or admin } } } @@ -164,8 +154,6 @@ function display_outcomes($contacted,$ca,$case_id) $_POST['confirm'] = true; } print ""; - - }