From c31f08058199cfa64007d7b2c2d731d34a7cb357 Mon Sep 17 00:00:00 2001 From: Adam Zammit Date: Thu, 11 May 2017 10:41:30 +1000 Subject: [PATCH] Opt out of web when opting out of CATI --- functions/functions.operator.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 9c6e831a..05fc2652 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -2301,6 +2301,22 @@ function end_case($operator_id) $o = $db->Execute($sql); + //if this is a refusal outcome - set Limesurvey as opt-out + $sql = "SELECT lime_sid + FROM questionnaire + WHERE questionnaire_id = '$questionnaire_id'"; + + $lime_sid = $db->GetOne($sql); + + $sql = "UPDATE ".LIME_PREFIX."tokens_$lime_sid as t, `case` as c, `outcome` as o + SET t.emailstatus = 'OptOut' + WHERE t.token = c.token + AND c.case_id = '$case_id' + AND o.outcome_id = '$outcome' + AND o.outcome_type_id = 3"; + + $db->Execute($sql); + $return = true; } else