From 4bd8410d0a47423b5c2f2150e634025a6b7f40dd Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Fri, 12 Jun 2020 12:16:16 +1000 Subject: [PATCH] New feature: Allow samples to specify existing token record Update to 2.3.0 release --- CHANGELOG | 10 ++++++++++ database/quexs.sql | 2 +- functions/functions.operator.php | 24 ++++++++++++------------ 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e9b2ea2b..7cc8f3f7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,13 @@ +queXS 2.3.0 - Changes since 2.2.6 + +New feature: Allow operators to search the sample (visible fields only) and assign cases to themselves + +New feature: Allow for samples to reference existing token records + +Requires database update: + alter table `case` drop index token; + alter table `case` add index (`token`); + queXS 2.2.6 - Changes since 2.2.5 Fixed bug: LimeSurvey reports session mismatch with token diff --git a/database/quexs.sql b/database/quexs.sql index 95bf4056..737d973c 100644 --- a/database/quexs.sql +++ b/database/quexs.sql @@ -226,10 +226,10 @@ CREATE TABLE `case` ( `token` varchar(36) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`case_id`), UNIQUE KEY `onecasepersample` (`sample_id`,`questionnaire_id`), - UNIQUE KEY `token` (`token`), UNIQUE KEY `current_operator_id` (`current_operator_id`), UNIQUE KEY `current_call_id` (`current_call_id`), KEY `sample_id` (`sample_id`), + KEY `token` (`token`), KEY `questionnaire_id` (`questionnaire_id`), KEY `sortorder` (`sortorder`), KEY `last_call_id` (`last_call_id`) diff --git a/functions/functions.operator.php b/functions/functions.operator.php index b262c5b0..bdcc52d9 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -343,20 +343,20 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing = $dtoken = $db->GetOne($sql); $ttries = 0; - - do { - if (empty($dtoken)) { - $token = sRandomChars(); - } else { - $token = $dtoken; - } + if (empty($dtoken)) { + + do { + $token = sRandomChars(); - $sql = "SELECT count(*) as c - FROM `case` - WHERE token = '$token'"; + $sql = "SELECT count(*) as c + FROM `case` + WHERE token = '$token'"; - $ttries++; - } while ($db->GetOne($sql) > 0 && $ttries < 10); + $ttries++; + } while ($db->GetOne($sql) > 0 && $ttries < 10); + } else { + $token = $dtoken; + } if ($ttries >= 10) //failed to get a token return false;