mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Email functions work!
This commit is contained in:
19
email.php
19
email.php
@@ -81,24 +81,15 @@ if (isset($_POST['email']) && ((isset($_POST['firstname']) && !empty($_POST['fir
|
|||||||
$lime_sid = get_lime_sid($case_id);
|
$lime_sid = get_lime_sid($case_id);
|
||||||
$ca = get_call_attempt($operator_id);
|
$ca = get_call_attempt($operator_id);
|
||||||
$token = get_token($case_id);
|
$token = get_token($case_id);
|
||||||
$email = $db->qstr($_POST['email']);
|
$email = ($_POST['email']);
|
||||||
$firstname = $db->qstr($_POST['firstname']);
|
$firstname = ($_POST['firstname']);
|
||||||
$lastname = $db->qstr($_POST['lastname']);
|
$lastname = ($_POST['lastname']);
|
||||||
|
|
||||||
|
|
||||||
//set in Limesurvey
|
$ret = lime_send_email($case_id,$email,$firstname,$lastname);
|
||||||
//set_participant_properties($sSessionKey, $lime_sid, array['token' => $token], array['email' => $email, 'firstname' => $firstname, 'lastname' => $lastname, 'emailstatus' => 'OK']);
|
|
||||||
|
|
||||||
|
if ($ret) //if mail sent
|
||||||
if (0) //if mail sent - disable temporarily TODO: update properties in limesurvey
|
|
||||||
{
|
{
|
||||||
// Put call attempt id in to sent in Limesurvey
|
|
||||||
$sql = "UPDATE ". LIME_PREFIX . "tokens_{$lime_sid}
|
|
||||||
SET sent='$ca'
|
|
||||||
WHERE token='$token'";
|
|
||||||
|
|
||||||
//$db->Execute($sql);
|
|
||||||
|
|
||||||
//Add a note that sent
|
//Add a note that sent
|
||||||
|
|
||||||
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
|
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
|
||||||
|
|||||||
@@ -150,13 +150,49 @@ function lime_list_answeroptions($qid,$qcode)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function lime_send_email($case_id,$email,$firstname,$lastname)
|
||||||
|
{
|
||||||
|
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),array('firstname' => $firstname, 'email' => $email, 'lastname' => $lastname));
|
||||||
|
if (!isset($q['status'])) {
|
||||||
|
//send email
|
||||||
|
$q2 = $limeRPC->invite_participants($limeKey, $lime_id, array($q['tid']));
|
||||||
|
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
|
||||||
*/
|
*/
|
||||||
function lime_get_responses_by_case($case_id,$fields = null)
|
function lime_get_responses_by_case($case_id,$fields = null)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
global $limeRPC;
|
global $limeRPC;
|
||||||
global $limeKey;
|
global $limeKey;
|
||||||
|
|
||||||
$sql = "SELECT c.token,c.questionnaire_id
|
$sql = "SELECT c.token,c.questionnaire_id
|
||||||
FROM `case` as c
|
FROM `case` as c
|
||||||
|
|||||||
Reference in New Issue
Block a user