mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Made get_call_attempt be able to not create a call attempt (just return one if necessary)
This commit is contained in:
@@ -698,8 +698,10 @@ function is_on_call($operator_id)
|
||||
|
||||
if ($case_id)
|
||||
{
|
||||
$ca = get_call_attempt($operator_id);
|
||||
$ca = get_call_attempt($operator_id,false);
|
||||
|
||||
if ($ca)
|
||||
{
|
||||
$sql = "SELECT call_id,state
|
||||
FROM `call`
|
||||
WHERE case_id = '$case_id'
|
||||
@@ -712,6 +714,7 @@ function is_on_call($operator_id)
|
||||
if (!empty($row))
|
||||
$call_state_id = $row['state'];
|
||||
}
|
||||
}
|
||||
|
||||
//if ($db->HasFailedTrans()) { print "FAILED in is_on_call"; exit; }
|
||||
if ($db->CompleteTrans())
|
||||
@@ -1132,7 +1135,7 @@ function end_call_attempt($operator_id)
|
||||
|
||||
$return = false;
|
||||
|
||||
$ca = get_call_attempt($operator_id);
|
||||
$ca = get_call_attempt($operator_id,false);
|
||||
|
||||
if ($ca)
|
||||
{
|
||||
@@ -1180,10 +1183,11 @@ function get_respondent_id($call_attempt_id)
|
||||
* Return the call attempt of the given operator
|
||||
*
|
||||
* @param int $operator_id The oeprator
|
||||
* @param bool $create If true, will create a call attempt if none exists
|
||||
* @return bool|int False if no case otherwise the call_attempt_id
|
||||
*
|
||||
*/
|
||||
function get_call_attempt($operator_id)
|
||||
function get_call_attempt($operator_id,$create = true)
|
||||
{
|
||||
global $db;
|
||||
|
||||
@@ -1203,12 +1207,12 @@ function get_call_attempt($operator_id)
|
||||
|
||||
$row = $db->GetRow($sql);
|
||||
|
||||
$id = false;
|
||||
|
||||
/**
|
||||
* If no call_attempt, create one
|
||||
*/
|
||||
if (empty($row))
|
||||
{
|
||||
if ($create)
|
||||
{
|
||||
$sql = "SELECT respondent_id
|
||||
FROM respondent
|
||||
@@ -1225,6 +1229,7 @@ function get_call_attempt($operator_id)
|
||||
$db->Execute($sql);
|
||||
$id = $db->Insert_Id();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$id = $row['call_attempt_id'];
|
||||
@@ -1262,7 +1267,7 @@ function end_call($operator_id,$outcome_id,$state = 5)
|
||||
|
||||
if ($ca)
|
||||
{
|
||||
$c = get_call_attempt($operator_id);
|
||||
$c = get_call_attempt($operator_id,false);
|
||||
if ($c)
|
||||
{
|
||||
$a = is_on_appointment($c); //if we were on an appointment, complete it with this call
|
||||
|
||||
Reference in New Issue
Block a user