From b5e0303350fe777ecf418228c81b75aaee429f72 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Wed, 15 Jun 2016 12:00:48 +1000 Subject: [PATCH] Fixed issue: Cannot delete outcomes --- admin/set_outcomes.php | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/admin/set_outcomes.php b/admin/set_outcomes.php index 0ebc5ace..b5cb1360 100644 --- a/admin/set_outcomes.php +++ b/admin/set_outcomes.php @@ -68,12 +68,12 @@ if (isset($_POST['default']) && isset($_POST['save'])){ AND o.outcome_id IN ($sel)"; $db->Execute($sql); } - if(!empty($_POST['delay']) && $_SESSION['user'] === "admin" ){ + if(!empty($_POST['delay'])){ foreach($_POST['delay'] as $n => $val) { $db->Execute("UPDATE `outcome`SET default_delay_minutes = $val WHERE outcome_id = $n"); } } - if(!empty($_POST['delete']) && $_SESSION['user'] === "admin" ){ + if(!empty($_POST['delete'])){ foreach($_POST['delete'] as $n => $val) { $db->Execute("DELETE FROM `outcome` WHERE outcome_id = $n AND outcome_id >= 100"); } @@ -121,7 +121,7 @@ if (isset($_POST['qid']) && $_POST['qid'] > 0 && isset($_POST['save'])){ unset($_POST['save']); } -if ($_SESSION['user'] === "admin" && isset($_POST['addoutcome']) && isset($_POST['save'])){ +if (isset($_POST['addoutcome']) && isset($_POST['save'])){ if (isset($_POST['description']) && !empty($_POST['description']) && intval($_POST['outcome_type_id']) > 0 ) { $desc = $_POST['description']; $outcome_type_id = intval($_POST['outcome_type_id']); @@ -166,7 +166,7 @@ xhtml_head($title,true,$css,$js_head); /* to add customm outcome*/ -if ($_SESSION['user'] === "admin" && isset($_GET['addoutcome'])){ +if (isset($_GET['addoutcome'])){ $rs[] = ["description" => "", "value" => ""]; $sql = "SELECT outcome_type_id as value,description FROM `outcome_type`"; @@ -258,14 +258,8 @@ if (isset($_GET['qid'])) { if (isset($_GET['default'])) { /* allow delay edit only to superadmins (currenlty admin) */ - if ($_SESSION['user'] === "admin"){ $delay = "CONCAT('') "; $delete = "CASE WHEN o.outcome_id >= 100 THEN CONCAT('') ELSE '' END as `delete`,"; - } - else { - $delay = "CONCAT('', o.default_delay_minutes ,' ')"; - $delete = ""; - } $sql = "SELECT o.*, ot.description as type, $delay as `delay`, $delete CONCAT('

".T_("Yes")."' ELSE 'default\">".T_("No")."' END , '

') as tryanother, CONCAT('

" . T_("Yes")."' ELSE 'default\">".T_("No")."' END , '

') as tryagain, @@ -281,7 +275,7 @@ if (isset($_GET['default'])) { $row = array("outcome_id","description","select","type","delay","contacted","tryanother","tryagain","eligible","require_note"); $hdr = array(T_("Outcome ID"),T_("Description"),T_("Set default")." ?",T_("Outcome type"),T_("Delay, min"),T_("Contacted")." ?",T_("Try another")." ?",T_("Try again")." ?",T_("Eligible")." ?",T_("Require note")." ?"); - if ($_SESSION['user'] === "admin"){ $row[] = "delete"; $hdr[] = T_("Delete")." ?";} + $row[] = "delete"; $hdr[] = T_("Delete")." ?"; $hid = "default"; $value = ""; $h = "default"; $v = ""; $abtn = T_("Add custom Outcome"); $sbtn = T_("Update default outcomes"); @@ -319,7 +313,7 @@ if (isset($rs) && !empty($rs)){
- +