mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Made calls, call attempts and cases only created in the one spot
This commit is contained in:
@@ -98,7 +98,7 @@ if(isset($_POST['start']) && isset($_POST['end']) && isset($_POST['day']) && iss
|
|||||||
$contact_phone_id = bigintval($_POST['contact_phone_id']);
|
$contact_phone_id = bigintval($_POST['contact_phone_id']);
|
||||||
$start = $_POST['start'];
|
$start = $_POST['start'];
|
||||||
$end = $_POST['end'];
|
$end = $_POST['end'];
|
||||||
$call_attempt_id = get_call_attempt($operator_id);
|
$call_attempt_id = get_call_attempt($operator_id,false);
|
||||||
|
|
||||||
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end);
|
make_appointment($respondent_id,$case_id,$contact_phone_id,$call_attempt_id,$day,$month,$year,$start,$end);
|
||||||
|
|
||||||
|
|||||||
6
call.php
6
call.php
@@ -150,9 +150,9 @@ if (isset($_POST['submit']))
|
|||||||
if (isset($_POST['contact_phone']))
|
if (isset($_POST['contact_phone']))
|
||||||
{
|
{
|
||||||
$contact_phone_id = bigintval($_POST['contact_phone']);
|
$contact_phone_id = bigintval($_POST['contact_phone']);
|
||||||
$call_attempt_id = get_call_attempt($operator_id);
|
$call_attempt_id = get_call_attempt($operator_id,false);
|
||||||
$respondent_id = get_respondent_id($call_attempt_id);
|
$respondent_id = get_respondent_id($call_attempt_id);
|
||||||
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id);
|
$call_id = get_call($operator_id,$respondent_id,$contact_phone_id,true);
|
||||||
if ($call_id)
|
if ($call_id)
|
||||||
{
|
{
|
||||||
if (VOIP_ENABLED)
|
if (VOIP_ENABLED)
|
||||||
@@ -206,7 +206,7 @@ if (isset($_POST['submit']))
|
|||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$call_attempt_id = get_call_attempt($operator_id);
|
$call_attempt_id = get_call_attempt($operator_id.false);
|
||||||
$case_id = get_case_id($operator_id);
|
$case_id = get_case_id($operator_id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ function get_respondent_variable($variable,$respondent_id)
|
|||||||
*/
|
*/
|
||||||
function template_replace($string,$operator_id,$case_id)
|
function template_replace($string,$operator_id,$case_id)
|
||||||
{
|
{
|
||||||
$respondent_id = get_respondent_id(get_call_attempt($operator_id));
|
$respondent_id = get_respondent_id(get_call_attempt($operator_id,false));
|
||||||
|
|
||||||
while (stripos($string, "{Respondent:") !== false)
|
while (stripos($string, "{Respondent:") !== false)
|
||||||
{
|
{
|
||||||
@@ -239,7 +239,7 @@ function is_respondent_selection($operator_id)
|
|||||||
* @param bool $create True if a case can be created
|
* @param bool $create True if a case can be created
|
||||||
* @return bool|int False if no case available else the case_id
|
* @return bool|int False if no case available else the case_id
|
||||||
*/
|
*/
|
||||||
function get_case_id($operator_id, $create = true)
|
function get_case_id($operator_id, $create = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
global $db;
|
global $db;
|
||||||
@@ -772,17 +772,18 @@ function is_on_call_attempt($operator_id)
|
|||||||
* @param int $operator_id The operator
|
* @param int $operator_id The operator
|
||||||
* @param string|int $respondent_id The respondent
|
* @param string|int $respondent_id The respondent
|
||||||
* @param string|int $contact_phone_id The number to contact the respondent on
|
* @param string|int $contact_phone_id The number to contact the respondent on
|
||||||
|
* @param bool $create Whether or not to create a call
|
||||||
* @return bool|int False if no call exists or can be created otherwise the call_id
|
* @return bool|int False if no call exists or can be created otherwise the call_id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_call($operator_id,$respondent_id = "",$contact_phone_id = "")
|
function get_call($operator_id,$respondent_id = "",$contact_phone_id = "",$create = false)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
$case_id = get_case_id($operator_id,false);
|
$case_id = get_case_id($operator_id,false);
|
||||||
$ca = get_call_attempt($operator_id);
|
$ca = get_call_attempt($operator_id,false);
|
||||||
|
|
||||||
$id = false;
|
$id = false;
|
||||||
|
|
||||||
@@ -798,7 +799,7 @@ function get_call($operator_id,$respondent_id = "",$contact_phone_id = "")
|
|||||||
$row = $db->GetRow($sql);
|
$row = $db->GetRow($sql);
|
||||||
if (empty($row))
|
if (empty($row))
|
||||||
{
|
{
|
||||||
if (!empty($respondent_id) && !empty($contact_phone_id))
|
if (!empty($respondent_id) && !empty($contact_phone_id) && $create)
|
||||||
{
|
{
|
||||||
$sql = "INSERT INTO `call` (call_id,operator_id,case_id,call_attempt_id,start,end,respondent_id,contact_phone_id,outcome_id,state)
|
$sql = "INSERT INTO `call` (call_id,operator_id,case_id,call_attempt_id,start,end,respondent_id,contact_phone_id,outcome_id,state)
|
||||||
VALUES (NULL,'$operator_id','$case_id','$ca',CONVERT_TZ(NOW(),'System','UTC'),NULL,'$respondent_id','$contact_phone_id','0','1')";
|
VALUES (NULL,'$operator_id','$case_id','$ca',CONVERT_TZ(NOW(),'System','UTC'),NULL,'$respondent_id','$contact_phone_id','0','1')";
|
||||||
@@ -841,7 +842,7 @@ function get_limesurvey_url($operator_id)
|
|||||||
|
|
||||||
$url = "nocaseavailable.php";
|
$url = "nocaseavailable.php";
|
||||||
|
|
||||||
$case_id = get_case_id($operator_id);
|
$case_id = get_case_id($operator_id,false);
|
||||||
|
|
||||||
if ($case_id)
|
if ($case_id)
|
||||||
{
|
{
|
||||||
@@ -1187,7 +1188,7 @@ function get_respondent_id($call_attempt_id)
|
|||||||
* @return bool|int False if no case otherwise the call_attempt_id
|
* @return bool|int False if no case otherwise the call_attempt_id
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function get_call_attempt($operator_id,$create = true)
|
function get_call_attempt($operator_id,$create = false)
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ xhtml_head(T_("queXS"), true, array("css/index.css","css/tabber.css") , array("j
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<object class="embeddedobject" id="main-content" data="<? get_case_id($operator_id); get_call_attempt($operator_id); if (!is_respondent_selection($operator_id)) print(get_limesurvey_url($operator_id)); else print "rs_intro.php"; ?>" standby="Loading questionnaire..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
|
<object class="embeddedobject" id="main-content" data="<? get_case_id($operator_id,true); get_call_attempt($operator_id,true); if (!is_respondent_selection($operator_id)) print(get_limesurvey_url($operator_id)); else print "rs_intro.php"; ?>" standby="Loading questionnaire..." type="application/xhtml+xml"><p>Error, try with Firefox</p></object>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="respondent">
|
<div id="respondent">
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ global $db;
|
|||||||
$db->StartTrans();
|
$db->StartTrans();
|
||||||
|
|
||||||
$operator_id = get_operator_id();
|
$operator_id = get_operator_id();
|
||||||
$call_attempt_id = get_call_attempt($operator_id);
|
$call_attempt_id = get_call_attempt($operator_id,false);
|
||||||
$case_id = get_case_id($operator_id);
|
$case_id = get_case_id($operator_id);
|
||||||
|
|
||||||
if (isset($_POST['submit']))
|
if (isset($_POST['submit']))
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ else if ($state == 3)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$ca = get_call_attempt($operator_id);
|
$ca = get_call_attempt($operator_id,false);
|
||||||
if ($ca)
|
if ($ca)
|
||||||
{
|
{
|
||||||
print "<div class='text'>" . get_respondent_time(get_respondent_id($ca),"%h:%i%p") ."</div>";
|
print "<div class='text'>" . get_respondent_time(get_respondent_id($ca),"%h:%i%p") ."</div>";
|
||||||
|
|||||||
Reference in New Issue
Block a user