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

Merged from Trunk

This commit is contained in:
Adam Zammit
2014-09-01 12:32:47 +10:00
59 changed files with 7534 additions and 1721 deletions

View File

@@ -313,20 +313,21 @@ function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sam
* @param string $lime_sgqa The limesurvey SGQA
* @param int $lime_sid The limesurvey survey id
* @param int $case_id The case id
* @param int $sample_import_id The sample import ID
* @param string $value The value to compare
* @param string $comparison The type of comparison
* @param int $sample_import_id The sample import ID
*
* @return bool|int False if failed, otherwise 1 if matched, 0 if doesn't
*
*/
function limesurvey_quota_match($lime_sgqa,$lime_sid,$case_id,$value,$comparison)
function limesurvey_quota_match($lime_sgqa,$lime_sid,$case_id,$value,$comparison,$sample_import_id)
{
global $db;
$sql = "SELECT count(*) as c
FROM " . LIME_PREFIX . "survey_$lime_sid as s
JOIN `case` as c ON (c.case_id = '$case_id')
JOIN `sample` as sam ON (c.sample_id = sam.sample_id)
JOIN `sample` as sam ON (c.sample_id = sam.sample_id and sam.import_id = $sample_import_id)
WHERE s.token = c.token
AND s.`$lime_sgqa` $comparison '$value'";
@@ -345,19 +346,20 @@ function limesurvey_quota_match($lime_sgqa,$lime_sid,$case_id,$value,$comparison
* @param int $case_id The case id
* @param string $val The sample value to compare
* @param string $var The sample variable to compare
* @param int $sample_import_id The sample import id we are looking at
*
* @return bool|int False if failed, otherwise 1 if matched, 0 if doesn't
* @author Adam Zammit <adam.zammit@acspri.org.au>
* @since 2012-04-30
*/
function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var)
function limesurvey_quota_replicate_match($lime_sid,$case_id,$val,$var,$sample_import_id)
{
global $db;
$sql = "SELECT count(*) as c
FROM " . LIME_PREFIX . "survey_$lime_sid as s
JOIN `case` as c ON (c.case_id = '$case_id')
JOIN `sample` as sam ON (c.sample_id = sam.sample_id)
JOIN `sample` as sam ON (c.sample_id = sam.sample_id and sam.import_id = $sample_import_id)
JOIN `sample_var` as sv ON (sv.sample_id = sam.sample_id AND sv.var LIKE '$var' AND sv.val LIKE '$val')
WHERE s.token = c.token";

View File

@@ -1881,7 +1881,7 @@ function update_row_quota($questionnaire_id,$case_id = false)
if ($update)
update_quota_priorities($questionnaire_id);
$db->CompleteTrans();
return false;
@@ -2127,7 +2127,7 @@ function end_case($operator_id)
//code as eligible if ever eligible, or if referred to the supervisor, code as that if last call
$sql = "SELECT c.outcome_id as outcome_id
FROM `call` as c
JOIN outcome AS o ON ( c.outcome_id = o.outcome_id AND (o.eligible = 1 OR o.outcome_type_id = 2) )
JOIN outcome AS o ON ( c.outcome_id = o.outcome_id AND (o.eligible = 1 OR o.outcome_type_id = 2 OR o.outcome_type_id = 1) )
WHERE c.case_id = '$case_id'
ORDER BY c.call_id DESC";

View File

@@ -76,7 +76,6 @@ function is_process_killed($process_id)
$sql = "SELECT `process_id`
FROM `process`
WHERE `kill` = 1
AND `stop` IS NULL
AND `process_id` = '$process_id'";
$rs = $db->GetRow($sql);