mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Opt out of web when opting out of CATI
This commit is contained in:
@@ -185,6 +185,37 @@ function lime_send_email($case_id,$email,$firstname,$lastname)
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lime_set_token_properties($case_id,$params = array('emailstatus' => 'OptOut'))
|
||||||
|
{
|
||||||
|
global $db;
|
||||||
|
global $limeRPC;
|
||||||
|
global $limeKey;
|
||||||
|
|
||||||
|
$sql = "SELECT c.token,c.questionnaire_id
|
||||||
|
FROM `case` as c
|
||||||
|
WHERE c.case_id = '$case_id'";
|
||||||
|
|
||||||
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
|
$token = $rs['token'];
|
||||||
|
$qid = $rs['questionnaire_id'];
|
||||||
|
|
||||||
|
$lime_id = limerpc_init_qid($qid);
|
||||||
|
|
||||||
|
$ret = false;
|
||||||
|
|
||||||
|
if ($lime_id !== false) {
|
||||||
|
$q = $limeRPC->set_participant_properties($limeKey,$lime_id,array('token' => $token),$params);
|
||||||
|
if (!isset($q['status'])) {
|
||||||
|
$ret = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
limerpc_close();
|
||||||
|
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Get completed responses as an array based on the case_id
|
/** Get completed responses as an array based on the case_id
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -2287,7 +2287,22 @@ function end_case($operator_id)
|
|||||||
SET current_operator_id = NULL, current_call_id = NULL, sortorder = NULL, current_outcome_id = '$outcome', last_call_id = '$lastcall'
|
SET current_operator_id = NULL, current_call_id = NULL, sortorder = NULL, current_outcome_id = '$outcome', last_call_id = '$lastcall'
|
||||||
WHERE case_id = '$case_id'";
|
WHERE case_id = '$case_id'";
|
||||||
|
|
||||||
$o = $db->Execute($sql);
|
$o = $db->Execute($sql);
|
||||||
|
|
||||||
|
//if this is a refusal outcome - set the Limesurvey token table to opt-out
|
||||||
|
//this will avoid sending email invitations once refused on the phone
|
||||||
|
|
||||||
|
$sql = "SELECT count(*)
|
||||||
|
FROM outcome
|
||||||
|
WHERE outcome_type_id = 3
|
||||||
|
AND outcome_id = $outcome";
|
||||||
|
|
||||||
|
$isrefusal = $db->GetOne($sql);
|
||||||
|
|
||||||
|
if ($isrefusal > 0) {
|
||||||
|
include_once(dirname(__FILE__).'/functions.limesurvey.php');
|
||||||
|
lime_set_token_properties($case_id,array('emailstatus' => 'OptOut'));
|
||||||
|
}
|
||||||
|
|
||||||
$return = true;
|
$return = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user