mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Fixes lp:1408870 Add "Maximum attempts reached" as an outcome
Dev: Updated outcomes to be 4 new outcomes (max calls, max call attempts split by eligible, unknown eligibility) Dev: Set the end_case function to set the outcomes to max call * reached if those variables set Dev: Made sure outcomes are temporary outcomes as otherwise numbers will not be available again if max call limits changed Dev: This means the outcomes are indicators only and could still be assigned to operators - it is merely a temporary case outcome (not a final outcome nor a call outcome)
This commit is contained in:
@@ -66,8 +66,11 @@ Database updates required:
|
|||||||
|
|
||||||
/* New outcomes */
|
/* New outcomes */
|
||||||
|
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.13', 'Max call attempts reached', 0, 1, 0, 1, 0, 1, 0, 'UH');
|
DELETE FROM `outcome` WHERE outcome_id IN (42,43,44,45);
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.13', 'Max calls reached', 0, 1, 0, 1, 0, 1, 0, 'UH');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.90', 'Max call attempts reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH');
|
||||||
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.90', 'Max calls reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH');
|
||||||
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(44, '2.30', 'Max call attempts reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(45, '2.30', 'Max calls reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
|
|
||||||
|
|
||||||
/* Add var_id sample var identifier */
|
/* Add var_id sample var identifier */
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ T_("Respondent last name");
|
|||||||
T_("Email address");
|
T_("Email address");
|
||||||
T_("Self completion email invitation sent");
|
T_("Self completion email invitation sent");
|
||||||
T_("Self completed online");
|
T_("Self completed online");
|
||||||
T_("Max call attempts reached");
|
T_("Max call attempts reached (Eligible)");
|
||||||
T_("Max calls reached");
|
T_("Max calls reached (Eligible)");
|
||||||
|
T_("Max call attempts reached (Unknown eligibility)");
|
||||||
|
T_("Max calls reached (Unknown eligibility)");
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ function display_outcomes($contacted,$ca,$case_id)
|
|||||||
$sql = "SELECT outcome_id,description,contacted
|
$sql = "SELECT outcome_id,description,contacted
|
||||||
FROM outcome
|
FROM outcome
|
||||||
WHERE contacted = '$contacted'
|
WHERE contacted = '$contacted'
|
||||||
AND outcome_id NOT IN(5,10,19,21,40,41,42,43)";
|
AND outcome_id NOT IN(5,10,19,21,40,41,42,43,44,45)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -133,7 +133,7 @@ function display_outcomes($contacted,$ca,$case_id)
|
|||||||
$sql = "SELECT outcome_id,description,contacted
|
$sql = "SELECT outcome_id,description,contacted
|
||||||
FROM outcome
|
FROM outcome
|
||||||
WHERE contacted = '$contacted'
|
WHERE contacted = '$contacted'
|
||||||
AND outcome_id NOT IN(5,10,19,21,40,41,42,43)";
|
AND outcome_id NOT IN(5,10,19,21,40,41,42,43,44,45)";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1091,8 +1091,11 @@ INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_m
|
|||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(33, '2.36', 'Miscellaneous - Unavailable for a week', 10080, 1, 0, 1, 1, 1, 0, 'O');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(33, '2.36', 'Miscellaneous - Unavailable for a week', 10080, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(40, '1.1', 'Self completed online', 0, 4, 0, 1, 1, 1, 0, 'I');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(40, '1.1', 'Self completed online', 0, 4, 0, 1, 1, 1, 0, 'I');
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(41, '2.36', 'Self completion email invitation sent', 10080, 1, 0, 1, 1, 1, 0, 'O');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(41, '2.36', 'Self completion email invitation sent', 10080, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.13', 'Max call attempts reached', 0, 1, 0, 1, 0, 1, 0, 'UH');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(42, '3.90', 'Max call attempts reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH');
|
||||||
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.13', 'Max calls reached', 0, 1, 0, 1, 0, 1, 0, 'UH');
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(43, '3.90', 'Max calls reached (Unknown eligibility)', 0, 1, 0, 1, 1, 0, 0, 'UH');
|
||||||
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(44, '2.30', 'Max call attempts reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
|
INSERT INTO `outcome` (`outcome_id`, `aapor_id`, `description`, `default_delay_minutes`, `outcome_type_id`, `tryanother`, `contacted`, `tryagain`, `eligible`, `require_note`, `calc`) VALUES(45, '2.30', 'Max calls reached (Eligible)', 0, 1, 0, 1, 1, 1, 0, 'O');
|
||||||
|
|
||||||
-- --------------------------------------------------------
|
-- --------------------------------------------------------
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|||||||
@@ -2171,9 +2171,9 @@ function end_case($operator_id)
|
|||||||
$lastcall = 0;
|
$lastcall = 0;
|
||||||
if (!empty($l))
|
if (!empty($l))
|
||||||
$lastcall = $l['call_id'];
|
$lastcall = $l['call_id'];
|
||||||
|
|
||||||
|
|
||||||
if ($count == 0) //no numbers to be tried again, get last outcome or 1
|
if ($count == 0) //no numbers to be tried again, get last outcome or 1
|
||||||
{
|
{
|
||||||
//last call
|
//last call
|
||||||
$sql = "SELECT c.outcome_id as outcome_id
|
$sql = "SELECT c.outcome_id as outcome_id
|
||||||
@@ -2191,23 +2191,70 @@ function end_case($operator_id)
|
|||||||
$outcome = $t['outcome_id'];
|
$outcome = $t['outcome_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($count >= 1) //one or more numbers to be tried again - first code as eligible if ever eligible...
|
else if ($count >= 1) //one or more numbers to be tried again - see if max calls reached, then code as eligible if ever eligible...
|
||||||
{
|
{
|
||||||
//$r[0]['contact_phone_id'];
|
$sql = "SELECT call_attempt_max,call_max
|
||||||
//code as eligible if ever eligible, or if referred to the supervisor, code as that if last call
|
FROM questionnaire_sample as qs, `case` as c
|
||||||
$sql = "SELECT c.outcome_id as outcome_id
|
WHERE c.case_id = '$case_id'
|
||||||
FROM `call` as c
|
AND qs.sample_id = c.sample_id
|
||||||
JOIN outcome AS o ON ( c.outcome_id = o.outcome_id AND (o.eligible = 1 OR o.outcome_type_id = 2 OR o.outcome_type_id = 1) )
|
AND qs.questionnaire_id = c.questionnaire_id";
|
||||||
WHERE c.case_id = '$case_id'
|
|
||||||
ORDER BY c.call_id DESC";
|
$cm = $db->GetRow($sql);
|
||||||
|
|
||||||
$t = $db->GetRow($sql);
|
|
||||||
|
|
||||||
if (!empty($t))
|
$sql = "SELECT COUNT(*) as c
|
||||||
$outcome = $t['outcome_id'];
|
FROM call_attempt
|
||||||
}
|
WHERE case_id = '$case_id'";
|
||||||
}
|
|
||||||
else
|
$callattempts = $db->GetOne($sql);
|
||||||
|
|
||||||
|
$sql = "SELECT COUNT(*) as c
|
||||||
|
FROM `call`
|
||||||
|
WHERE case_id = '$case_id'";
|
||||||
|
|
||||||
|
$calls = $db->GetOne($sql);
|
||||||
|
|
||||||
|
$eligsql = "SELECT count(*)
|
||||||
|
FROM `call` as c, `outcome` as o
|
||||||
|
WHERE c.outcome_id = o.outcome_id
|
||||||
|
AND o.eligible = 1
|
||||||
|
AND c.case_id = '$case_id'";
|
||||||
|
|
||||||
|
if ($cm['call_attempt_max'] > 0 && $callattempts >= $cm['call_attempt_max']) //max call attempts reached
|
||||||
|
{
|
||||||
|
//if ever eligible, code as eligible
|
||||||
|
if ($db->GetOne($eligsql) > 0)
|
||||||
|
$outcome = 44;
|
||||||
|
else
|
||||||
|
$outcome = 42;
|
||||||
|
}
|
||||||
|
else if ($cm['call_max'] > 0 && $calls >= $cm['call_max']) //max calls reached
|
||||||
|
{
|
||||||
|
//if ever eligible, code as eligible
|
||||||
|
if ($db->GetOne($eligsql) > 0)
|
||||||
|
$outcome = 45;
|
||||||
|
else
|
||||||
|
$outcome = 43;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
//$r[0]['contact_phone_id'];
|
||||||
|
//code as eligible if ever eligible, or if referred to the supervisor, code as that if last call
|
||||||
|
$sql = "SELECT c.outcome_id as outcome_id
|
||||||
|
FROM `call` as c
|
||||||
|
JOIN outcome AS o ON ( c.outcome_id = o.outcome_id AND (o.eligible = 1 OR o.outcome_type_id = 2 OR o.outcome_type_id = 1) )
|
||||||
|
WHERE c.case_id = '$case_id'
|
||||||
|
ORDER BY c.call_id DESC";
|
||||||
|
|
||||||
|
$t = $db->GetRow($sql);
|
||||||
|
|
||||||
|
if (!empty($t))
|
||||||
|
$outcome = $t['outcome_id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
//the last call is the call with the final otucome
|
//the last call is the call with the final otucome
|
||||||
$outcome = $a['outcome_id'];
|
$outcome = $a['outcome_id'];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: queXS\n"
|
"Project-Id-Version: queXS\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2015-08-07 15:48+1000\n"
|
"POT-Creation-Date: 2015-08-10 16:24+1000\n"
|
||||||
"PO-Revision-Date: \n"
|
"PO-Revision-Date: \n"
|
||||||
"Last-Translator: Adam Zammit <adam.zammit@acspri.org.au>\n"
|
"Last-Translator: Adam Zammit <adam.zammit@acspri.org.au>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
@@ -3589,11 +3589,19 @@ msgid "Self completed online"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: admin/databasestrings.php:91
|
#: admin/databasestrings.php:91
|
||||||
msgid "Max call attempts reached"
|
msgid "Max call attempts reached (Eligible)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: admin/databasestrings.php:92
|
#: admin/databasestrings.php:92
|
||||||
msgid "Max calls reached"
|
msgid "Max calls reached (Eligible)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: admin/databasestrings.php:93
|
||||||
|
msgid "Max call attempts reached (Unknown eligibility)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: admin/databasestrings.php:94
|
||||||
|
msgid "Max calls reached (Unknown eligibility)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: call_interface2.php:116
|
#: call_interface2.php:116
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ $sql = "SELECT count(s.sample_id) as count_samples
|
|||||||
AND si.enabled = 1
|
AND si.enabled = 1
|
||||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||||
AND ou.outcome_type_id IN( SELECT outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id')
|
AND ou.outcome_type_id IN( SELECT outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id')
|
||||||
AND ou.outcome_id NOT IN (10,25,28,42,43,40) ";
|
AND ou.outcome_id NOT IN (10,25,28,42,43,44,45,40) ";
|
||||||
|
|
||||||
$rs = $db->GetRow($sql);
|
$rs = $db->GetRow($sql);
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ else
|
|||||||
AND s.import_id IN ($siid)
|
AND s.import_id IN ($siid)
|
||||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||||
AND ou.outcome_type_id IN( SELECT outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id')
|
AND ou.outcome_type_id IN( SELECT outcome_type_id FROM operator_skill WHERE operator_id = '$operator_id')
|
||||||
AND ou.outcome_id NOT IN (10,25,28,42,43,40)";
|
AND ou.outcome_id NOT IN (10,25,28,42,43,44,45,40)";
|
||||||
$cases_count = $db->GetRow($sql);
|
$cases_count = $db->GetRow($sql);
|
||||||
|
|
||||||
if ($cases_count['count_samples'] == 0){
|
if ($cases_count['count_samples'] == 0){
|
||||||
|
|||||||
Reference in New Issue
Block a user