From 6a8842a007fc363960cff7d14962e1619d801308 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 9 Sep 2015 03:43:48 +0300 Subject: [PATCH 01/18] add file and links --- admin/index.php | 4 +- admin/set_outcomes.php | 252 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 255 insertions(+), 1 deletion(-) create mode 100644 admin/set_outcomes.php diff --git a/admin/index.php b/admin/index.php index 6be6b8f4..75f41971 100644 --- a/admin/index.php +++ b/admin/index.php @@ -98,6 +98,7 @@ include ("../lang.inc.php");
  • +
  • @@ -161,8 +162,9 @@ include ("../lang.inc.php");
  • @@ -162,7 +162,7 @@ include ("../lang.inc.php");
  • From 89d32aee24fd2bc954c60244df45097380e1f035 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 18 Nov 2015 20:33:35 +0300 Subject: [PATCH 09/18] more DB update changelog --- DB update CHANGELOG | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/DB update CHANGELOG b/DB update CHANGELOG index 7092e214..ff054ec6 100644 --- a/DB update CHANGELOG +++ b/DB update CHANGELOG @@ -1,15 +1,19 @@ required DB updates: +/* -- add `default` and `const` parameters for outcomes -- */ ALTER TABLE `outcome` ADD `deflt` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Used as default for questionnaire outcomes' AFTER `calc`, ADD `const` TINYINT(1) UNSIGNED NOT NULL COMMENT 'Permanent outcome, used for all questionnaires, not possible to de-select' AFTER `deflt`; -UPDATE `outcome` SET `const` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19,30,31) ; +/* -- define and set mandatory(constant) outcome_id's --*/ +UPDATE `outcome` SET `const` = '1' WHERE `outcome`.`outcome_id` IN (1,2,3,7,9,10,14,17,18,19) ; -ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,10' COMMENT 'coma-separated string of outcomes defined for the questionnaire' AFTER `enabled`; +/* -- add `outcomes` parameter , define default list of outcome_ID's to be enabled for new questionnaries --*/ +ALTER TABLE `questionnaire` ADD `outcomes` VARCHAR(256) NULL DEFAULT '1,2,3,7,9,10,14,17,18,19' COMMENT 'coma-separated string of outcomes defined for the questionnaire' AFTER `enabled`; + +/* -- enable all outcomes for existing questionnaires -- */ +UPDATE `questionnaire` SET `outcomes` = '1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,40,41,42,43,44,45' ; -queXS 1.13.0 - Changes since 1.12.1 ---- From 384cd149a944152e8436f5e3d5f4596da5f3045d Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 18 Nov 2015 21:53:52 +0300 Subject: [PATCH 10/18] enable/disable referral and invitation outcomes depending on questionnaire settings; provide outcome "delay" edit only for admin --- admin/set_outcomes.php | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/admin/set_outcomes.php b/admin/set_outcomes.php index 0d598c4a..7d21762c 100644 --- a/admin/set_outcomes.php +++ b/admin/set_outcomes.php @@ -69,6 +69,14 @@ if (isset($_POST['default']) && isset($_POST['save'])){ $db->Execute($sql); } + if(!empty($_POST['delay']) && $_SESSION['user'] === "admin" ){ + + foreach($_POST['delay'] as $n => $val) + { + $sql = "UPDATE `outcome`SET default_delay_minutes = $val WHERE outcome_id = $n"; + $db->Execute($sql); + } + } $_GET['default'] = $_POST['default']; @@ -138,7 +146,11 @@ if (isset($_GET['qid'])) { if ($qid != false) { - $qoutc = $db->GetOne("SELECT q.outcomes FROM `questionnaire` as q WHERE q.questionnaire_id = $qid"); + $qd = $db->GetRow("SELECT outcomes, self_complete, referral FROM `questionnaire` WHERE questionnaire_id = $qid"); + + $qoutc = $qd['outcomes']; + $sc = $qd['self_complete']; + $ref = $qd['referral']; if (empty($qoutc)) { // update q.outcomes with default list @@ -163,7 +175,12 @@ if (isset($_GET['qid'])) { } $sql = "SELECT o.*, ot.description as type, - CONCAT('') as `select` + CONCAT('') as `select` from `outcome` as o, `outcome_type` as ot WHERE o.outcome_type_id = ot.outcome_type_id ORDER BY `o`.`outcome_id` ASC"; @@ -181,6 +198,7 @@ if (isset($_GET['qid'])) { if (isset($_GET['default'])) { $sql = "SELECT o.*, ot.description as type, + CONCAT('') as `delay`, CONCAT('

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

    ') as tryanother, CONCAT('

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

    ') as tryagain, CONCAT('

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

    ') as contacted, @@ -193,8 +211,12 @@ if (isset($_GET['default'])) { $rs = $db->GetAll($sql); - $row = array("outcome_id","description","select","type","default_delay_minutes","contacted","tryanother","tryagain","eligible","require_note"); + $row = array("outcome_id","description","select","type","delay","contacted","tryanother","tryagain","eligible","require_note"); $hdr = array(T_("Outcome ID"),T_("Description"),T_("Default"),T_("Outcome type"),T_("Delay, min"),T_("Contacted"),T_("Try another"),T_("Try again"),T_("Eligible"),T_("Require note")); + + /* allow delay edit only to superadmins (currenlty admin) */ + if ( $_SESSION['user'] != "admin"){ unset($row[4]); unset($hdr[4]); } + $hid = "default"; $value = ""; From eff3a27a2564469328eb32d701b000193119de4a Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 18 Nov 2015 21:58:17 +0300 Subject: [PATCH 11/18] 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 ""; - - if (isset ($_GET['contacted'])){ - - $contacted = bigintval($_GET['contacted']); - + print ""; + + 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 ""; - - } From 3514f1ad82d95794c5f5808fae4d4cfc1f47a413 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Fri, 20 Nov 2015 10:25:08 +1100 Subject: [PATCH 12/18] Added sample sort code in CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index a0e4d362..d3f2dd29 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -54,6 +54,7 @@ DROP TABLE `sessions2`; /* Add sort order feature to questionnaire sample table */ ALTER TABLE `questionnaire_sample` ADD `sort_order` INT( 11 ) NOT NULL DEFAULT '0'; +UPDATE `questionnaire_sample` SET sort_order = sample_import_id; queXS 1.13.1 - Changes since 1.13.0 From 299b6230011fa3e805ca388bc8bc5d68c00b722d Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Fri, 20 Nov 2015 11:57:14 +1100 Subject: [PATCH 13/18] Added link to operator panel --- admin/index.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/admin/index.php b/admin/index.php index ddb860e8..47d5c137 100644 --- a/admin/index.php +++ b/admin/index.php @@ -85,6 +85,11 @@ include ("../functions/functions.operator.php");