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

Cases being now being created and linked properly

This commit is contained in:
Adam Zammit
2017-02-08 13:36:09 +11:00
parent e7fb940e17
commit c231970ea6
2 changed files with 32 additions and 37 deletions

View File

@@ -223,7 +223,7 @@ function lime_add_token($qid,$params)
$lime_id = limerpc_init_qid($qid);
if ($lime_id !== false) {
$l = $limeRPC->add_participants($limeKey,$lime_id,$params,false); //don't create token
$l = $limeRPC->add_participants($limeKey,$lime_id,array($params),false); //don't create token
if (!isset($l['status'])) {
$ret = $l; //array of data
}
@@ -240,7 +240,7 @@ function get_token_value($questionnaire_id,$token, $value = 'sent')
global $limeRPC;
$ret = false;
$lime_id = limerpc_init_qid($qid);
$lime_id = limerpc_init_qid($questionnaire_id);
if ($lime_id !== false) {
$l = $limeRPC->get_participant_properties($limeKey,$lime_id,array('token'=>$token),array($value));
@@ -585,20 +585,6 @@ function getRandomID()
}
function get_lime_url($case_id)
{
global $db;
$sql = "SELECT r.entry_url
FROM remote as r, `case` as c, questionnaire as q
WHERE c.case_id = $case_id
AND c.questionnaire_id = q.questionnaire_id
AND q.remote_id = r.id";
return $db->GetOne($sql);
}
/**
* Return the limesurvey id given the case_id
*

View File

@@ -435,29 +435,25 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing =
$lfirstname = "";
$llastname = "";
$lemail = "";
if ($addlimeattributes)
{
$lfirstname = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '6'"));
$llastname = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '7'"));
$lfirstname = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '6'"));
$lemail = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '8'"));
$llastname = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '7'"));
$lemail = ($db->GetOne("SELECT sv.val
FROM sample_var as sv, sample_import_var_restrict as s
WHERE sv.var_id = s.var_id
AND sv.sample_id = '$sample_id'
AND s.type = '8'"));
}
//include limesurvey functions
include_once(dirname(__FILE__).'/functions.limesurvey.php');
@@ -1276,6 +1272,19 @@ function get_respondentselection_url($operator_id,$escape = true,$interface2 = f
return $url;
}
function get_lime_url($case_id)
{
global $db;
$sql = "SELECT r.entry_url
FROM remote as r, `case` as c, questionnaire as q
WHERE c.case_id = $case_id
AND c.questionnaire_id = q.questionnaire_id
AND q.remote_id = r.id";
return $db->GetOne($sql);
}
/**
* Get the complete URL for the Limesurvey questionnaire
* If no case available, return an error screen
@@ -1303,7 +1312,7 @@ function get_limesurvey_url($operator_id)
$token = $db->GetOne($sql);
$sid = get_limesurvey_id($operator_id);
$url = get_lime_url($case_id) . "/sid/$sid/token/$token/lang/" . DEFAULT_LOCALE;
$url = get_lime_url($case_id) . "/$sid/token/$token/lang/" . DEFAULT_LOCALE;
$questionnaire_id = get_questionnaire_id($operator_id);
//get prefills