echo T_("Adding a client here will allow them to access project information in the client subdirectory. You can assign a client to a particular project using the"); ?> echo T_("Assign client to Questionnaire"); ?> echo T_("tool."); ?>
-
echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?>
+
+
+
-
+
-
+
-
echo T_("Choose the CSV sample file to upload:"); ?>
echo T_("Use this form to enter the username of a user based on your directory security system. For example, if you have secured the base directory of queXS using Apache file based security, enter the usernames of the users here."); ?>
+
+
.
+
-
+
-
+
-
+" . T_("Add an availability group to this questionnaire:") . "";
?>
-
+ " . T_("Go back") . "";
echo "
From 618a1acead9c33318cf8ad6926740eae3eb4b3d6 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Tue, 26 Feb 2013 12:37:04 +1100
Subject: [PATCH 23/40] Can now send email invitation Need to fix completion
via link (template not working) also call outcome setting is causing problem
when not ending call
---
email.php | 154 ++++++++++++++++++++++++-----
functions/functions.limesurvey.php | 24 +++++
2 files changed, 153 insertions(+), 25 deletions(-)
diff --git a/email.php b/email.php
index c4ec61e7..86caa0c2 100644
--- a/email.php
+++ b/email.php
@@ -85,38 +85,142 @@ if (isset($_POST['firstname']))
$db->Execute($sql);
+ //Send email
+ include_once("include/limesurvey/classes/phpmailer/class.phpmailer.php");
+ $fieldsarray = array();
+ $fieldsarray["{EMAIL}"]=$_POST['email'];
+ $fieldsarray["{FIRSTNAME}"]=$_POST['firstname'];
+ $fieldsarray["{LASTNAME}"]=$_POST['lastname'];
+ $fieldsarray["{TOKEN}"]=$token;
+ $fieldsarray["{LANGUAGE}"]=DEFAULT_LOCALE;
+ $fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$lime_sid;
+ //$fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"];
- if (isset($_POST['submith']))
+ $sql = "SELECT s.var,s.val
+ FROM `sample_var` as s, `case` as c
+ WHERE c.case_id = $case_id
+ AND s.sample_id = c.sample_id";
+
+ $attributes = $db->GetAssoc($sql);
+
+ //Assign sample variables
+ foreach ($attributes as $attributefield=>$val)
{
- end_call($operator_id,41); //end with outcome sent
- if (is_voip_enabled($operator_id))
- {
- include("functions/functions.voip.php");
- $v = new voip();
- $v->connect(VOIP_SERVER);
- $v->hangup(get_extension($operator_id));
- }
- //disable recording
- $newtext = T_("Start REC");
- $js = "js/window.js";
- if (browser_ie()) $js = "js/window_ie6.js";
- xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'");
-
+ $fieldsarray['{SAMPLE:'.strtoupper($attributefield).'}']=$val;
}
- else if (isset($_POST['submit']))
- {
- $call_id = get_call($operator_id);
- $sql = "UPDATE `call` as c
- SET c.outcome_id = 41
- WHERE c.call_id = $call_id";
+ $fieldsarray["{OPTOUTURL}"]=LIME_URL . "optout.php?lang=".trim(DEFAULT_LOCALE)."&sid=$lime_sid&token={$token}";
+ $fieldsarray["{SURVEYURL}"]=LIME_URL . "index.php?lang=".trim(DEFAULT_LOCALE)."&sid=$lime_sid&token={$token}";
+ $barebone_link=$fieldsarray["{SURVEYURL}"];
+
+ $customheaders = array( '1' => "X-surveyid: ".$lime_sid, '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]);
+
+ $sql = "SELECT surveyls_email_invite_subj, surveyls_email_invite
+ FROM `lime_surveys_languagesettings`
+ WHERE `surveyls_survey_id` = $lime_sid
+ order by surveyls_language LIKE '" . DEFAULT_LOCALE . "' DESC";
+
+ $econtent = $db->GetRow($sql);
+
+ $modsubject = $econtent['surveyls_email_invite_subj'];
+ $modmessage = $econtent['surveyls_email_invite'];
+
+ foreach ( $fieldsarray as $key => $value )
+ {
+ $modsubject=str_replace($key, $value, $modsubject);
+ }
+
+ foreach ( $fieldsarray as $key => $value )
+ {
+ $modmessage=str_replace($key, $value, $modmessage);
+ }
+
+ $modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
+ $modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
+
+ $mail = new PHPMailer;
+
+ $sql = "SELECT stg_value
+ FROM " . LIME_PREFIX . "settings_global
+ WHERE stg_name LIKE 'siteadminemail'";
+
+ $fromemail = $db->GetOne($sql);
+
+ $sql = "SELECT stg_value
+ FROM " . LIME_PREFIX . "settings_global
+ WHERE stg_name LIKE 'siteadminname'";
+
+ $fromname = $db->GetOne($sql);
+
+ $mail->SetFrom($fromemail,$fromname);
+ $mail->AddAddress($_POST['email']);
+ foreach ($customheaders as $key=>$val)
+ {
+ $mail->AddCustomHeader($val);
+ }
+ $mail->AddCustomHeader("X-Surveymailer: queXS Emailer (quexs.sourceforge.net)");
+
+ $mail->IsHTML(true);
+ $mail->Body = $modmessage;
+ $mail->AltBody = trim(strip_tags(html_entity_decode($modmessage,ENT_QUOTES,'UTF-8')));
+ $mail->Subject = $modsubject;
+
+
+ if ($mail->Send())
+ {
+ // Put date into sent
+ $today = date("Y-m-d H:i:s");
+
+ $sql = "UPDATE ". LIME_PREFIX . "tokens_{$lime_sid}
+ SET sent='$today'
+ WHERE token='$token'";
$db->Execute($sql);
-
- xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
+
+ //Add a note that sent
+
+ $sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
+ VALUES ($case_id,$operator_id,'" . T_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',NOW())";
+
+ $db->Execute($sql);
+
+
+ if (isset($_POST['submith']))
+ {
+ end_call($operator_id,41); //end with outcome sent
+ if (is_voip_enabled($operator_id))
+ {
+ include("functions/functions.voip.php");
+ $v = new voip();
+ $v->connect(VOIP_SERVER);
+ $v->hangup(get_extension($operator_id));
+ }
+ //disable recording
+ $newtext = T_("Start REC");
+ $js = "js/window.js";
+ if (browser_ie()) $js = "js/window_ie6.js";
+ xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='toggleRec(\"$newtext\",\"record.php?start=start\",\"offline\"); openParentObject(\"main-content\",\"" . get_respondentselection_url($operator_id) . "\"); parent.closePopup();'");
+
+ }
+ else if (isset($_POST['submit']))
+ {
+ $call_id = get_call($operator_id);
+
+ $sql = "UPDATE `call` as c
+ SET c.outcome_id = 41
+ WHERE c.call_id = $call_id";
+
+ $db->Execute($sql);
+
+ xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
+ }
+ xhtml_foot();
+ die();
+ }
+ else
+ {
+ $msg = T_("The email did not send");
}
- xhtml_foot();
- die();
}
else
{
diff --git a/functions/functions.limesurvey.php b/functions/functions.limesurvey.php
index 352a4780..66b54dc7 100644
--- a/functions/functions.limesurvey.php
+++ b/functions/functions.limesurvey.php
@@ -42,6 +42,30 @@ include_once(dirname(__FILE__).'/../config.inc.php');
*/
include_once(dirname(__FILE__).'/../db.inc.php');
+
+/**
+ * Strip comments from email taken from limesurvey common functions
+ *
+ * @param mixed $comment
+ * @param mixed $email
+ * @param resource $replace Optional, defaults to ''.
+ *
+ * @return TODO
+ * @author Adam Zammit
+ * @since 2013-02-26
+ */
+function strip_comments($comment, $email, $replace=''){
+
+ while (1){
+ $new = preg_replace("!$comment!", $replace, $email);
+ if (strlen($new) == strlen($email)){
+ return $email;
+ }
+ $email = $new;
+ }
+}
+
+
/*function validate_email($email)
{
// Create the syntactical validation regular expression
From 11df5b93b52068d31def1098de9a99b7f9ea7279 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Tue, 26 Feb 2013 12:41:30 +1100
Subject: [PATCH 24/40] Disabled updating of call outcome when not hanging up -
need to alter other code or decide how to determine that an invitation was
sent via email
---
email.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/email.php b/email.php
index 86caa0c2..78f3fe1b 100644
--- a/email.php
+++ b/email.php
@@ -204,6 +204,7 @@ if (isset($_POST['firstname']))
}
else if (isset($_POST['submit']))
{
+ /*
$call_id = get_call($operator_id);
$sql = "UPDATE `call` as c
@@ -211,7 +212,8 @@ if (isset($_POST['firstname']))
WHERE c.call_id = $call_id";
$db->Execute($sql);
-
+ */
+
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
}
xhtml_foot();
From 971eb8d584d30442709a8005cd4291bbf9752ee2 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 09:28:00 +1100
Subject: [PATCH 25/40] Save call attempt id in to sent when sent and set
default call id
---
call.php | 14 +++++++++-----
email.php | 17 +++--------------
2 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/call.php b/call.php
index 3f5fb3c9..0ce64cb5 100644
--- a/call.php
+++ b/call.php
@@ -134,13 +134,17 @@ function display_outcomes($contacted,$ca,$case_id)
print "
";
if (!empty($rs))
{
- //Get current outcome to set as default
- $sql = "SELECT outcome
- FROM `call`
- WHERE call_attempt_id = $ca
- AND `end` IS NULL";
+ $lime_sid = get_limesurvey_id(get_operator_id());
+
+ //Check to see if we have sent an email on this call and set the default outcome
+ $sql = "SELECT 41
+ FROM `case` as c, " . LIME_PREFIX . "tokens_$lime_sid as t
+ WHERE t.sent = '$ca'
+ AND c.case_id = $case_id
+ AND t.token = c.token";
$do = $db->GetOne($sql);
+
if (isset($_GET['defaultoutcome'])) $do = bigintval($_GET['defaultoutcome']);
foreach($rs as $r)
{
diff --git a/email.php b/email.php
index 78f3fe1b..dcda6c21 100644
--- a/email.php
+++ b/email.php
@@ -73,6 +73,7 @@ if (isset($_POST['firstname']))
{
$case_id = get_case_id($operator_id);
$lime_sid = get_lime_sid($case_id);
+ $ca = get_call_attempt($operator_id);
$token = get_token($case_id);
$email = $db->qstr($_POST['email']);
$firstname = $db->qstr($_POST['firstname']);
@@ -168,11 +169,9 @@ if (isset($_POST['firstname']))
if ($mail->Send())
{
- // Put date into sent
- $today = date("Y-m-d H:i:s");
-
+ // Put call attempt id in to sent
$sql = "UPDATE ". LIME_PREFIX . "tokens_{$lime_sid}
- SET sent='$today'
+ SET sent='$ca'
WHERE token='$token'";
$db->Execute($sql);
@@ -204,16 +203,6 @@ if (isset($_POST['firstname']))
}
else if (isset($_POST['submit']))
{
- /*
- $call_id = get_call($operator_id);
-
- $sql = "UPDATE `call` as c
- SET c.outcome_id = 41
- WHERE c.call_id = $call_id";
-
- $db->Execute($sql);
- */
-
xhtml_head(T_("Email"),true,array("css/call.css"),array($js),"onload='parent.closePopup();'");
}
xhtml_foot();
From 4896c60f04279e9abf4e32238cab4515c180f1a9 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 14:26:44 +1100
Subject: [PATCH 26/40] Make sure to get path of template right HTaccess remove
space that caused error
---
include/limesurvey/.htaccess.example | 2 +-
include/limesurvey/group.php | 4 +++-
include/limesurvey/index.php | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/limesurvey/.htaccess.example b/include/limesurvey/.htaccess.example
index a1c5bab2..a57f3ad0 100644
--- a/include/limesurvey/.htaccess.example
+++ b/include/limesurvey/.htaccess.example
@@ -1,4 +1,4 @@
AuthType None
Satisfy Any
-Order Deny, Allow
+Order Deny,Allow
Allow from All
diff --git a/include/limesurvey/group.php b/include/limesurvey/group.php
index fc6de19e..51d85581 100644
--- a/include/limesurvey/group.php
+++ b/include/limesurvey/group.php
@@ -470,13 +470,15 @@ else
$quexs_url = get_start_interview_url();
$url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
+
+ $end_url = $url;
if ($interviewer)
{
$end_url = get_end_interview_url();
}
else
{
- $url = get_end_interview_url($clienttoken);
+ $end_url = get_end_interview_url($clienttoken);
quexs_completed_by_respondent($surveyid,$clienttoken);
}
diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php
index 419eb0a4..757432a7 100644
--- a/include/limesurvey/index.php
+++ b/include/limesurvey/index.php
@@ -544,7 +544,7 @@ if ($interviewer)
}
else
{
- $thistpl=quexs_get_template($clienttoken);
+ $thistpl=sGetTemplatePath(quexs_get_template($clienttoken));
}
From 62c59377656c77b116acd633e8e44342aa0d5e16 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 14:30:53 +1100
Subject: [PATCH 27/40] Avoid notice if getting operator id when not one
---
include/limesurvey/quexs.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/limesurvey/quexs.php b/include/limesurvey/quexs.php
index aac48d11..93b4a7c6 100644
--- a/include/limesurvey/quexs.php
+++ b/include/limesurvey/quexs.php
@@ -514,6 +514,8 @@ function get_respondent_variable($variable,$respondent_id)
*/
function get_operator_id()
{
+ if (!isset($_SERVER['PHP_AUTH_USER'])) return false;
+
$db = newADOConnection(DB_TYPE);
$db->Connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
$db->SetFetchMode(ADODB_FETCH_ASSOC);
From 2b7eeff881d4c0dc7469f2dad5d2b456a7957be3 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 15:04:47 +1100
Subject: [PATCH 28/40] Only display email button when enabled for
questionnaire Set a case note when completed online
---
email.php | 46 +++++++++++++++++++++++-------------
include/limesurvey/quexs.php | 14 ++++++++++-
index.php | 12 ++++++++--
3 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/email.php b/email.php
index dcda6c21..a9ebbc1b 100644
--- a/email.php
+++ b/email.php
@@ -226,25 +226,37 @@ if (browser_ie()) $js = "js/window_ie6.js";
xhtml_head(T_("Email"),true,array("css/call.css"),array($js));
+$sql = "SELECT q.self_complete
+ FROM questionnaire as q, `case` as c
+ WHERE c.case_id = $case_id
+ AND c.questionnaire_id = q.questionnaire_id";
-$sql = "SELECT sv1.val as firstname, sv2.val as lastname, sv3.val as email
- FROM `case` as c
- LEFT JOIN sample_var as sv1 on (sv1.sample_id = c.sample_id AND sv1.type = 6)
- LEFT JOIN sample_var as sv2 on (sv2.sample_id = c.sample_id AND sv2.type = 7)
- LEFT JOIN sample_var as sv3 on (sv3.sample_id = c.sample_id AND sv3.type = 8)
- WHERE c.case_id = $case_id";
-
-$rs = $db->GetRow($sql);
-
-print "
" . T_("Email respondent for self completion") . "
";
-if (!empty($msg)) print "
$msg
";
-print "";
+$sc = $db->GetOne($sql);
+if ($sc == 1)
+{
+ $sql = "SELECT sv1.val as firstname, sv2.val as lastname, sv3.val as email
+ FROM `case` as c
+ LEFT JOIN sample_var as sv1 on (sv1.sample_id = c.sample_id AND sv1.type = 6)
+ LEFT JOIN sample_var as sv2 on (sv2.sample_id = c.sample_id AND sv2.type = 7)
+ LEFT JOIN sample_var as sv3 on (sv3.sample_id = c.sample_id AND sv3.type = 8)
+ WHERE c.case_id = $case_id";
+
+ $rs = $db->GetRow($sql);
+
+ print "
" . T_("Email respondent for self completion") . "
";
+ if (!empty($msg)) print "
$msg
";
+ print "";
+}
+else
+{
+ print "
" . T_("Self completion email not available for this questionnaire") . "
";
+}
xhtml_foot();
diff --git a/include/limesurvey/quexs.php b/include/limesurvey/quexs.php
index 93b4a7c6..baac46ae 100644
--- a/include/limesurvey/quexs.php
+++ b/include/limesurvey/quexs.php
@@ -102,10 +102,22 @@ function quexs_completed_by_respondent($surveyid,$clienttoken)
$db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "UPDATE `case`
- SET current_outcome_id = 34
+ SET current_outcome_id = 40
WHERE token = '$clienttoken'";
$db->Execute($sql);
+
+ $sql = "SELECT case_id
+ FROM `case`
+ WHERE token = '$clienttoken'";
+
+ $case_id = $db->GetOne($sql);
+
+ //Add a case note to clarify (need to translate this string)
+ $sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
+ VALUES ($case_id,1,'Self completed online',NOW())";
+
+ $db->Execute($sql);
}
diff --git a/index.php b/index.php
index e838f105..00d17bda 100644
--- a/index.php
+++ b/index.php
@@ -130,6 +130,15 @@ else if (HEADER_EXPANDER_MANUAL)
xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script;
+$case_id = get_case_id($operator_id,true);
+
+$sql = "SELECT q.self_complete
+ FROM questionnaire as q, `case` as c
+ WHERE c.case_id = $case_id
+ AND c.questionnaire_id = q.questionnaire_id";
+
+$sc = $db->GetOne($sql);
+
?>
@@ -137,7 +146,7 @@ print $script;
-
+
'/>
@@ -146,7 +155,6 @@ print $script;
Date: Wed, 27 Feb 2013 15:07:07 +1100
Subject: [PATCH 29/40] NOW() should be converted to UTC
---
email.php | 2 +-
include/limesurvey/optout.php | 2 +-
include/limesurvey/quexs.php | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/email.php b/email.php
index a9ebbc1b..64f27fb7 100644
--- a/email.php
+++ b/email.php
@@ -179,7 +179,7 @@ if (isset($_POST['firstname']))
//Add a note that sent
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
- VALUES ($case_id,$operator_id,'" . T_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',NOW())";
+ VALUES ($case_id,$operator_id,'" . T_("Self completion invitation sent via email to") . ": " . $_POST['email'] . "',CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
diff --git a/include/limesurvey/optout.php b/include/limesurvey/optout.php
index a7e9fc17..14a8cffa 100644
--- a/include/limesurvey/optout.php
+++ b/include/limesurvey/optout.php
@@ -79,7 +79,7 @@ else
//Add a case note to clarify (need to translate this string)
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
- VALUES ($case_id,1,'Self completion refused via opt out function',NOW())";
+ VALUES ($case_id,1,'Self completion refused via opt out function',CONVERT_TZ(NOW(),'System','UTC'))";
$connect->Execute($sql);
diff --git a/include/limesurvey/quexs.php b/include/limesurvey/quexs.php
index baac46ae..7193d65f 100644
--- a/include/limesurvey/quexs.php
+++ b/include/limesurvey/quexs.php
@@ -115,7 +115,7 @@ function quexs_completed_by_respondent($surveyid,$clienttoken)
//Add a case note to clarify (need to translate this string)
$sql = "INSERT INTO `case_note` (case_id,operator_id,note,datetime)
- VALUES ($case_id,1,'Self completed online',NOW())";
+ VALUES ($case_id,1,'Self completed online',CONVERT_TZ(NOW(),'System','UTC'))";
$db->Execute($sql);
}
From 0b07934419775ac06dbfc91f486d14770616a420 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 15:37:04 +1100
Subject: [PATCH 30/40] Fixed template URL for self completors
---
include/limesurvey/index.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php
index 757432a7..cafc9b1e 100644
--- a/include/limesurvey/index.php
+++ b/include/limesurvey/index.php
@@ -544,6 +544,7 @@ if ($interviewer)
}
else
{
+ $thissurvey['templatedir'] = quexs_get_template($clienttoken);
$thistpl=sGetTemplatePath(quexs_get_template($clienttoken));
}
From a81d74debc38d0934af501cb8b909271c4f38a2f Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 15:59:43 +1100
Subject: [PATCH 31/40] Fix END URL for self completion
---
include/limesurvey/group.php | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/limesurvey/group.php b/include/limesurvey/group.php
index 51d85581..986428bd 100644
--- a/include/limesurvey/group.php
+++ b/include/limesurvey/group.php
@@ -467,22 +467,21 @@ else
//queXS Addition
include_once("quexs.php");
- $quexs_url = get_start_interview_url();
- $url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
-
- $end_url = $url;
if ($interviewer)
{
+ $quexs_url = get_start_interview_url();
+ $url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url);
+
$end_url = get_end_interview_url();
+ $url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
}
else
{
- $end_url = get_end_interview_url($clienttoken);
+ $url = get_end_interview_url($clienttoken);
quexs_completed_by_respondent($surveyid,$clienttoken);
}
- $url = str_replace("{ENDINTERVIEWURL}", $end_url, $url);
header("Location: {$url}");
}
From e427854eab5929e0eafb96f19dff5eb8183ea528 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Wed, 27 Feb 2013 16:09:11 +1100
Subject: [PATCH 32/40] Added email to alternate interface
---
index_interface2.php | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/index_interface2.php b/index_interface2.php
index b0034e8a..4fc7a393 100644
--- a/index_interface2.php
+++ b/index_interface2.php
@@ -195,11 +195,21 @@ else if (HEADER_EXPANDER_MANUAL)
xhtml_head(T_("queXS"), $body, array("css/index_interface2.css","css/tabber_interface2.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script;
+$case_id = get_case_id($operator_id,true);
+
+$sql = "SELECT q.self_complete
+ FROM questionnaire as q, `case` as c
+ WHERE c.case_id = $case_id
+ AND c.questionnaire_id = q.questionnaire_id";
+
+$sc = $db->GetOne($sql);
+
?>
" . T_("Any collected data and the limesurvey instrument will NOT be deleted") . "
";
+ print "
" . T_("The questionnaire will be deleted from queXS including call history, cases, case notes, respondent details, appointments and the links between operators, clients and the questionnaire") . "
";
+ print "
" . T_("Please confirm you wish to delete the questionnaire") . "
";
+
+ print "";
+}
else
{
- $columns = array("description","enabledisable","modify");
- $titles = array(T_("Questionnaire"),T_("Enable/Disable"),("Modify"));
+ $columns = array("description","enabledisable","modify","deletee");
+ $titles = array(T_("Questionnaire"),T_("Enable/Disable"),T_("Modify"),T_("Delete"));
$sql = "SELECT
description,
@@ -237,7 +403,8 @@ else
CONCAT('" . T_("Disable") . "')
END
as enabledisable,
- CONCAT('" . T_("Modify"). "') as modify
+ CONCAT('" . T_("Modify"). "') as modify,
+ CONCAT('" . T_("Delete"). "') as deletee
FROM questionnaire";
$rs = $db->GetAll($sql);
From 33b3091ad32b966dc23fe0d7715210b8fe39fd64 Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Thu, 7 Mar 2013 13:03:38 +1100
Subject: [PATCH 39/40] Give a message if updating usernames without password
---
admin/operatorlist.php | 58 +++++++++++++++++++++++-------------------
1 file changed, 32 insertions(+), 26 deletions(-)
diff --git a/admin/operatorlist.php b/admin/operatorlist.php
index 3698aa69..b49d2847 100644
--- a/admin/operatorlist.php
+++ b/admin/operatorlist.php
@@ -54,37 +54,43 @@ if (isset($_POST['submit']))
if (isset($_POST['voip'])) $voip = 1;
if (isset($_POST['enabled'])) $enabled = 1;
- $sql = "UPDATE operator
- SET username = " . $db->qstr($_POST['username']) . ",
- lastName = " . $db->qstr($_POST['lastName']) . ",
- firstName = " . $db->qstr($_POST['firstName']) . ",
- extension = " . $db->qstr($_POST['extension']) . ",
- extension_password = " . $db->qstr($_POST['extension_password']) . ",
- Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
- voip = $voip, enabled = $enabled
- WHERE operator_id = $operator_id";
-
- $rs = $db->Execute($sql);
-
- if (!empty($rs))
+ if (HTPASSWD_PATH !== false && $_POST['existing_username'] != $_POST['username'] && empty($_POST['password']))
{
- if (HTPASSWD_PATH !== false && !empty($_POST['password']))
- {
- //update password in htaccess
- include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
- $htp = New Htpasswd(HTPASSWD_PATH);
- $htp->deleteUser($_POST["existing_username"]);
- $htp->deleteUser($_POST["username"]);
- $htp->addUser($_POST["username"],$_POST["password"]);
- }
-
- $msg = T_("Successfully updated user");
+ $msg = T_("If changing usernames, you must specify a new password");
}
else
{
- $msg = T_("Failed to update user. Please make sure the username and extension are unique");
- }
+ $sql = "UPDATE operator
+ SET username = " . $db->qstr($_POST['username']) . ",
+ lastName = " . $db->qstr($_POST['lastName']) . ",
+ firstName = " . $db->qstr($_POST['firstName']) . ",
+ extension = " . $db->qstr($_POST['extension']) . ",
+ extension_password = " . $db->qstr($_POST['extension_password']) . ",
+ Time_zone_name = " . $db->qstr($_POST['timezone']) . ",
+ voip = $voip, enabled = $enabled
+ WHERE operator_id = $operator_id";
+ $rs = $db->Execute($sql);
+
+ if (!empty($rs))
+ {
+ if (HTPASSWD_PATH !== false && !empty($_POST['password']))
+ {
+ //update password in htaccess
+ include_once(dirname(__FILE__).'/../functions/functions.htpasswd.php');
+ $htp = New Htpasswd(HTPASSWD_PATH);
+ $htp->deleteUser($_POST["existing_username"]);
+ $htp->deleteUser($_POST["username"]);
+ $htp->addUser($_POST["username"],$_POST["password"]);
+ }
+
+ $msg = T_("Successfully updated user");
+ }
+ else
+ {
+ $msg = T_("Failed to update user. Please make sure the username and extension are unique");
+ }
+ }
$_GET['edit'] = $operator_id;
}
From e311c1df7b479e81f104a405feb6f972ec54287f Mon Sep 17 00:00:00 2001
From: Adam Zammit
Date: Thu, 7 Mar 2013 15:32:09 +1100
Subject: [PATCH 40/40] New feature: Allow restricting appointment to just
yourself
---
admin/displayappointments.php | 31 ++++++++++++++++++++++++++-----
appointment.php | 6 +++++-
appointmentlist.php | 5 +++--
functions/functions.calendar.php | 8 ++++++--
functions/functions.operator.php | 4 ++++
5 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/admin/displayappointments.php b/admin/displayappointments.php
index 9602a935..b1419501 100644
--- a/admin/displayappointments.php
+++ b/admin/displayappointments.php
@@ -119,10 +119,13 @@ if (isset($_GET['start']) && isset($_GET['appointment_id']))
$end = $db->qstr($_GET['end']);
$contact_phone_id = bigintval($_GET['contact_phone_id']);
$respondent_id = bigintval($_GET['respondent_id']);
+ $require_operator_id = "NULL";
+ if ($_GET['require_operator_id'] > 1) $require_operator_id = bigintval($_GET['require_operator_id']);
//Edit this appointment in the database
$sql = "UPDATE appointment as a, respondent as r
- SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id
+ SET a.start = CONVERT_TZ($start,r.Time_zone_name,'UTC'), a.end = CONVERT_TZ($end,r.Time_zone_name,'UTC'), a.contact_phone_id = $contact_phone_id, a.respondent_id = $respondent_id,
+ a.require_operator_id = $require_operator_id
WHERE a.appointment_id = $appointment_id
AND r.respondent_id = $respondent_id";
@@ -156,7 +159,7 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
xhtml_head(T_("Edit appointment"),false,$css,$js);
print "";
- $sql = "SELECT a.contact_phone_id,a.call_attempt_id,CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as start,CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as end,a.respondent_id
+ $sql = "SELECT a.contact_phone_id,a.call_attempt_id,CONVERT_TZ(a.start,'UTC',r.Time_zone_name) as start,CONVERT_TZ(a.end,'UTC',r.Time_zone_name) as end,a.respondent_id,a.require_operator_id
FROM appointment as a, respondent as r
WHERE a.appointment_id = '$appointment_id'
AND a.case_id = '$case_id'
@@ -168,6 +171,7 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
{
$respondent_id = $rs['respondent_id'];
$contact_phone_id = $rs['contact_phone_id'];
+ $require_operator_id = $rs['require_operator_id'];
$start = $rs['start'];
$end = $rs['end'];
@@ -188,6 +192,22 @@ if (isset($_GET['appointment_id']) && isset($_GET['case_id']))
print "
";
print "";
+ print "
";
+ $ops = $db->GetAll(" SELECT o.operator_id as value,
+ CONCAT(o.firstName, ' ', o.lastName) as description,
+ CASE WHEN o.operator_id = '$require_operator_id' THEN 'selected=\'selected\'' ELSE '' END as selected
+ FROM operator as o");
+ $selected = "selected=\'selected\'";
+ foreach($ops as $o)
+ {
+ if (!empty($o['selected']))
+ {
+ $selected = "";
+ break;
+ }
+ }
+ array_unshift($ops,array('value'=>0,'description'=>T_("Any operator"),'selected'=>$selected));
+ display_chooser($ops,"require_operator_id","require_operator_id",false,false,false,false);
print "";
print "";
@@ -206,20 +226,21 @@ else
print "
" . T_("Appointments") . "
" . T_("All appointments (with times displayed in your time zone)") . "
";
- $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". T_("Delete") . "') as link, CONCAT('". T_("Edit") . "') as edit
+ $sql = "SELECT q.description, CONVERT_TZ(a.start,'UTC',o.Time_zone_name) as start, CONVERT_TZ(a.end,'UTC',o.Time_zone_name) as end, r.firstName, r.lastName, IFNULL(ou.description,'" . T_("Not yet called") . "') as outcome, oo.firstName as makerName, ooo.firstName as callerName, CONCAT('', c.case_id, '') as case_id, CONCAT('". T_("Delete") . "') as link, CONCAT('". T_("Edit") . "') as edit,IFNULL(ao.firstName,'" . T_("Any operator") . "') as witho
FROM appointment as a
JOIN (`case` as c, respondent as r, questionnaire as q, operator as o, operator as oo, call_attempt as cc) on (a.case_id = c.case_id and a.respondent_id = r.respondent_id and q.questionnaire_id = c.questionnaire_id and o.operator_id = '$operator_id' and a.call_attempt_id = cc.call_attempt_id and cc.operator_id = oo.operator_id)
LEFT JOIN (`call` as ca, outcome as ou, operator as ooo) ON (ca.call_id = a.completed_call_id and ou.outcome_id = ca.outcome_id and ca.operator_id = ooo.operator_id)
+ LEFT JOIN operator AS ao ON ao.operator_id = a.require_operator_id
WHERE a.end >= CONVERT_TZ(NOW(),'System','UTC')
ORDER BY a.start ASC";
$rs = $db->GetAll($sql);
-
+
if (!empty($rs))
{
translate_array($rs,array("outcome"));
- xhtml_table($rs,array("description","case_id","start","end","makerName","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),T_("Operator Name"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit")));
+ xhtml_table($rs,array("description","case_id","start","end","makerName","witho","firstName","lastName","outcome","callerName","link","edit"),array(T_("Questionnaire"),T_("Case ID"),T_("Start"),T_("End"),T_("Operator Name"),T_("Appointment with"),T_("Respondent Name"),T_("Surname"),T_("Current outcome"),T_("Operator who called"),T_("Delete"),T_("Edit")));
}
else
print "