diff --git a/functions/functions.operator.php b/functions/functions.operator.php index 181dcb57..496ac17c 100644 --- a/functions/functions.operator.php +++ b/functions/functions.operator.php @@ -2190,9 +2190,10 @@ function end_case($operator_id) $outcome = 1; //default outcome is 1 - not attempted //last call - $sql = "SELECT call_id,outcome_id - FROM `call` - WHERE case_id = '$case_id' + $sql = "SELECT c.call_id,c.outcome_id, o.tryanother + FROM `call` as c, `outcome` as o + WHERE case_id = '$case_id' + AND c.outcome_id = o.outcome_id ORDER BY call_id DESC LIMIT 1"; @@ -2250,7 +2251,7 @@ function end_case($operator_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 ($l['tryanother'] == 1 && $cm['call_attempt_max'] > 0 && $callattempts >= $cm['call_attempt_max']) //max call attempts reached AND last call to be tried again { //if ever eligible, code as eligible if ($db->GetOne($eligsql) > 0) @@ -2258,7 +2259,7 @@ function end_case($operator_id) else $outcome = 42; } - else if ($cm['call_max'] > 0 && $calls >= $cm['call_max']) //max calls reached + else if ($l['tryanother'] == 1 && $cm['call_max'] > 0 && $calls >= $cm['call_max']) //max calls reached AND last call to be tried again { //if ever eligible, code as eligible if ($db->GetOne($eligsql) > 0) @@ -2286,7 +2287,7 @@ function end_case($operator_id) } else { - //the last call is the call with the final otucome + //there was a call with the final otucome $outcome = $a['outcome_id']; $lastcall = $a['call_id'];