2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

New feature: Allow samples to specify existing token record

Update to 2.3.0 release
This commit is contained in:
Adam Zammit
2020-06-12 12:16:16 +10:00
parent 8478f113ef
commit 4bd8410d0a
3 changed files with 23 additions and 13 deletions

View File

@@ -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

View File

@@ -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`)

View File

@@ -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;