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

merged rev. 475 "Add Max calls and attempts"

This commit is contained in:
Alex
2015-08-10 20:28:52 +03:00
8 changed files with 95 additions and 33 deletions

View File

@@ -66,8 +66,11 @@ Database updates required:
/* 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');
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');
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(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 */

View File

@@ -88,7 +88,8 @@ T_("Respondent last name");
T_("Email address");
T_("Self completion email invitation sent");
T_("Self completed online");
T_("Max call attempts reached");
T_("Max calls reached");
T_("Max call attempts reached (Eligible)");
T_("Max calls reached (Eligible)");
T_("Max call attempts reached (Unknown eligibility)");
T_("Max calls reached (Unknown eligibility)");
?>

View File

@@ -123,7 +123,7 @@ function display_outcomes($contacted,$ca,$case_id)
$sql = "SELECT outcome_id,description,contacted
FROM outcome
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
@@ -133,7 +133,7 @@ function display_outcomes($contacted,$ca,$case_id)
$sql = "SELECT outcome_id,description,contacted
FROM outcome
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)";
}
}
}

View File

@@ -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(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(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(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');
-- --------------------------------------------------------
--

View File

@@ -2171,9 +2171,9 @@ function end_case($operator_id)
$lastcall = 0;
if (!empty($l))
$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
$sql = "SELECT c.outcome_id as outcome_id
@@ -2191,23 +2191,70 @@ function end_case($operator_id)
$outcome = $t['outcome_id'];
}
}
else if ($count >= 1) //one or more numbers to be tried again - first code as eligible if ever eligible...
{
//$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);
else if ($count >= 1) //one or more numbers to be tried again - see if max calls reached, then code as eligible if ever eligible...
{
$sql = "SELECT call_attempt_max,call_max
FROM questionnaire_sample as qs, `case` as c
WHERE c.case_id = '$case_id'
AND qs.sample_id = c.sample_id
AND qs.questionnaire_id = c.questionnaire_id";
$cm = $db->GetRow($sql);
if (!empty($t))
$outcome = $t['outcome_id'];
}
}
else
$sql = "SELECT COUNT(*) as c
FROM call_attempt
WHERE case_id = '$case_id'";
$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
$outcome = $a['outcome_id'];

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: queXS\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"
"Last-Translator: Adam Zammit <adam.zammit@acspri.org.au>\n"
"Language-Team: \n"
@@ -3589,11 +3589,19 @@ msgid "Self completed online"
msgstr ""
#: admin/databasestrings.php:91
msgid "Max call attempts reached"
msgid "Max call attempts reached (Eligible)"
msgstr ""
#: 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 ""
#: call_interface2.php:116

View File

@@ -156,7 +156,7 @@ $sql = "SELECT count(s.sample_id) as count_samples
AND si.enabled = 1
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_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);

View File

@@ -149,7 +149,7 @@ else
AND s.import_id IN ($siid)
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_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);
if ($cases_count['count_samples'] == 0){