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

Only display email button when enabled for questionnaire

Set a case note when completed online
This commit is contained in:
Adam Zammit
2013-02-27 15:04:47 +11:00
parent 62c5937765
commit 2b7eeff881
3 changed files with 52 additions and 20 deletions

View File

@@ -226,25 +226,37 @@ if (browser_ie()) $js = "js/window_ie6.js";
xhtml_head(T_("Email"),true,array("css/call.css"),array($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 $sc = $db->GetOne($sql);
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 "<div class='status'>" . T_("Email respondent for self completion") . "</div>";
if (!empty($msg)) print "<p>$msg</p>";
print "<form action='?' method='post'>";
print "<div><label for='firstname'>" . T_("First name") . "</label><input type='text' value='{$rs['firstname']}' name='firstname' id='firstname'/></div>";
print "<div><label for='lastname'>" . T_("Last name") . "</label><input type='text' value='{$rs['lastname']}' name='lastname' id='lastname'/></div>";
print "<div><label for='email'>" . T_("Email") . "</label><input type='text' value='{$rs['email']}' name='email' id='email'/></div>";
print "<div><input type='submit' value='" . T_("Send invitation") . "' name='submit' id='submit'/></div>";
print "<div><input type='submit' value='" . T_("Send invitation and Hang up") . "' name='submith' id='submith'/></div></form>";
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 "<div class='status'>" . T_("Email respondent for self completion") . "</div>";
if (!empty($msg)) print "<p>$msg</p>";
print "<form action='?' method='post'>";
print "<div><label for='firstname'>" . T_("First name") . "</label><input type='text' value='{$rs['firstname']}' name='firstname' id='firstname'/></div>";
print "<div><label for='lastname'>" . T_("Last name") . "</label><input type='text' value='{$rs['lastname']}' name='lastname' id='lastname'/></div>";
print "<div><label for='email'>" . T_("Email") . "</label><input type='text' value='{$rs['email']}' name='email' id='email'/></div>";
print "<div><input type='submit' value='" . T_("Send invitation") . "' name='submit' id='submit'/></div>";
print "<div><input type='submit' value='" . T_("Send invitation and Hang up") . "' name='submith' id='submith'/></div></form>";
}
else
{
print "<p>" . T_("Self completion email not available for this questionnaire") . "</p>";
}
xhtml_foot(); xhtml_foot();

View File

@@ -102,10 +102,22 @@ function quexs_completed_by_respondent($surveyid,$clienttoken)
$db->SetFetchMode(ADODB_FETCH_ASSOC); $db->SetFetchMode(ADODB_FETCH_ASSOC);
$sql = "UPDATE `case` $sql = "UPDATE `case`
SET current_outcome_id = 34 SET current_outcome_id = 40
WHERE token = '$clienttoken'"; WHERE token = '$clienttoken'";
$db->Execute($sql); $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);
} }

View File

@@ -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); 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; 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);
?> ?>
<div id="casefunctions" class="header"> <div id="casefunctions" class="header">
@@ -137,7 +146,7 @@ print $script;
<div class='box'><a href="javascript:poptastic('appointment.php');"><?php echo T_("Appointment"); ?></a></div> <div class='box'><a href="javascript:poptastic('appointment.php');"><?php echo T_("Appointment"); ?></a></div>
<div class='box important'><a href="javascript:poptastic('call.php');"><?php echo T_("Call/Hangup"); ?></a></div> <div class='box important'><a href="javascript:poptastic('call.php');"><?php echo T_("Call/Hangup"); ?></a></div>
<div class='box'><a href="javascript:poptastic('supervisor.php');"><?php echo T_("Supervisor"); ?></a></div> <div class='box'><a href="javascript:poptastic('supervisor.php');"><?php echo T_("Supervisor"); ?></a></div>
<div class='box'><a href="javascript:poptastic('email.php');"><?php echo T_("Email"); ?></a></div> <?php if ($sc == 1) { ?><div class='box'><a href="javascript:poptastic('email.php');"><?php echo T_("Email"); ?></a></div><?php } ?>
<div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><?php echo T_("Start REC"); ?></a></div> <div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><?php echo T_("Start REC"); ?></a></div>
<?php if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.png' alt='<?php echo T_('Arrow for expanding or contracting'); ?>'/></div> <?php } ?> <?php if (HEADER_EXPANDER_MANUAL){ ?> <div class='headerexpand'><img id='headerexpandimage' src='./images/arrow-up-2.png' alt='<?php echo T_('Arrow for expanding or contracting'); ?>'/></div> <?php } ?>
<div class='box'><a href='index.php?'><?php echo T_("Restart"); ?></a></div> <div class='box'><a href='index.php?'><?php echo T_("Restart"); ?></a></div>
@@ -146,7 +155,6 @@ print $script;
<div id="content" class="content"> <div id="content" class="content">
<?php <?php
$case_id = get_case_id($operator_id,true);
$ca = get_call_attempt($operator_id,true); $ca = get_call_attempt($operator_id,true);
$appointment = false; $appointment = false;
$availability = is_using_availability($case_id); $availability = is_using_availability($case_id);