mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Updated to trunk
This commit is contained in:
49
CHANGELOG
49
CHANGELOG
@@ -1,3 +1,12 @@
|
||||
Database updates:
|
||||
|
||||
CREATE TABLE `questionnaire_sample_timeslot` (
|
||||
`questionnaire_id` bigint( 20 ) NOT NULL ,
|
||||
`sample_import_id` bigint( 20 ) NOT NULL ,
|
||||
`availability_group_id` bigint( 20 ) NOT NULL ,
|
||||
PRIMARY KEY ( `questionnaire_id` , `availability_group_id` , `sample_import_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
|
||||
|
||||
CREATE TABLE `qsqr_question` (
|
||||
`qsqr_question_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`questionnaire_sample_quota_row_id` bigint(20) NOT NULL,
|
||||
@@ -38,6 +47,46 @@ ALTER TABLE `questionnaire_sample_quota_row`
|
||||
DROP `exclude_var`,
|
||||
DROP `exclude_val`;
|
||||
|
||||
queXS 1.11.1 - Changes since 1.11.0
|
||||
|
||||
Fixed Bug: Quota priority not able to override sort of last call made
|
||||
Fixed Bug lp:1410503 required URLto the CKeditor installation directory
|
||||
Fixed Bug lp:1411703 Asign cases even with sample disabled and sample unassigned from questionnaire
|
||||
Fixed Bug lp:1412389 removed language restriction
|
||||
Fixes Bug lp:141380 System sort process fails when quotas enabled and limesurvey instrument de-activated
|
||||
Fix error in translation where thinks it is a wildcard
|
||||
|
||||
Translations: Updated from Launchpad. Thank you again!
|
||||
|
||||
queXS 1.11.0 - Changes since 1.10.4
|
||||
|
||||
New Feature: System sort on a questionnaire by questionnaire basis
|
||||
New Feature: Time slots for cases (make sure cases are called over specified timeslots equally)
|
||||
New Feature: Ability to disable and enable new records being drawn from a sample
|
||||
New Feature: Default timezone can be set in Administrative interface instead of config file
|
||||
|
||||
Fixed Bug: lp:1394819 Automatic dialling doesn't work when using "No respondent selection"
|
||||
Fixed Bug: lp:1394818 - Quota completions not displayed above 100%
|
||||
Fixed Bug: Operator extension not clearing correctly at end of work
|
||||
Fixed Bug: Notices generated when running index_update.php
|
||||
Fixed Bug: lp:1362415 Use of eregi and split are deprecated
|
||||
Fixed Bug: lp:1362418 - Cannot originate calls on Asterisk 11
|
||||
|
||||
Translations: Updated from Launchpad. Thank you!
|
||||
|
||||
Database updates:
|
||||
|
||||
ALTER TABLE `questionnaire_sample` ADD `allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1';
|
||||
|
||||
CREATE TABLE `questionnaire_timeslot` (
|
||||
`questionnaire_id` bigint( 20 ) NOT NULL ,
|
||||
`availability_group_id` bigint( 20 ) NOT NULL ,
|
||||
PRIMARY KEY ( `questionnaire_id` , `availability_group_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
|
||||
|
||||
INSERT INTO `setting` (`setting_id`,`field`,`value`)
|
||||
VALUES (NULL , 'DEFAULT_TIME_ZONE', 's:18:"Australia/Victoria";');
|
||||
|
||||
queXS 1.10.4 - Changes since 1.10.3
|
||||
|
||||
Fixed bug: Quota priority could get below 0
|
||||
|
||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
#queXS
|
||||
|
||||
An Open Source, web based, CATI system
|
||||
|
||||
queXS can operate your outbound telephone research centre. It integrates with the Asterisk VoIP Server, uses AAPOR Standard Outcome codes and only requires a web browser to operate.
|
||||
|
||||
Development for queXS occurs on Launchpad: https://launchpad.net/quexs
|
||||
@@ -69,10 +69,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['sample']) && isset($_GET['
|
||||
$am = bigintval($_GET['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_GET['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_GET['allownew'])) $an = 1;
|
||||
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages)
|
||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am')";
|
||||
$sql = "INSERT INTO questionnaire_sample(questionnaire_id,sample_import_id,call_max,call_attempt_max,random_select,answering_machine_messages,allow_new)
|
||||
VALUES('$questionnaire_id','$sid','$cm','$cam','$selecttype','$am', '$an')";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
@@ -89,13 +90,17 @@ if (isset($_POST['edit']))
|
||||
$am = bigintval($_POST['answering_machine_messages']);
|
||||
$selecttype = 0;
|
||||
if (isset($_POST['selecttype'])) $selecttype = 1;
|
||||
$an = 0;
|
||||
if (isset($_POST['allownew'])) $an = 1;
|
||||
|
||||
|
||||
|
||||
$sql = "UPDATE questionnaire_sample
|
||||
SET call_max = '$cm',
|
||||
call_attempt_max = '$cam',
|
||||
random_select = '$selecttype',
|
||||
answering_machine_messages = '$am'
|
||||
answering_machine_messages = '$am',
|
||||
allow_new = '$an'
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sid'";
|
||||
|
||||
@@ -119,7 +124,8 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
q.call_max,
|
||||
q.call_attempt_max,
|
||||
q.random_select,
|
||||
q.answering_machine_messages
|
||||
q.answering_machine_messages,
|
||||
q.allow_new
|
||||
FROM questionnaire_sample as q, sample_import as si, questionnaire as qr
|
||||
WHERE q.sample_import_id = si.sample_import_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
@@ -134,9 +140,11 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
|
||||
print "<p><a href='?questionnaire_id=$questionnaire_id'>" . T_("Go back") . "</a></p>";
|
||||
|
||||
$selected ="";
|
||||
$allownew = $selected ="";
|
||||
if ($qs['random_select'] == 1)
|
||||
$selected = "checked=\"checked\"";
|
||||
if ($qs['allow_new'] == 1)
|
||||
$allownew = "checked=\"checked\"";
|
||||
|
||||
?>
|
||||
<form action="?questionnaire_id=<?php echo $questionnaire_id;?>" method="post">
|
||||
@@ -144,6 +152,7 @@ if (isset($_GET['questionnaire_id']) && isset($_GET['rsid']))
|
||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="<?php echo $qs['call_attempt_max'];?>"/> <br/>
|
||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="<?php echo $qs['answering_machine_messages'];?>"/> <br/>
|
||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" <?php echo $selected;?> /> <br/>
|
||||
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" <?php echo $allownew;?> /> <br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sid); ?>"/>
|
||||
<input type="submit" name="edit" value="<?php echo T_("Edit"); ?>"/></p>
|
||||
@@ -181,6 +190,7 @@ if ($questionnaire_id != false)
|
||||
CASE WHEN q.call_attempt_max = 0 THEN '" . TQ_("Unlimited") . "' ELSE q.call_attempt_max END AS call_attempt_max,
|
||||
CASE WHEN q.random_select = 0 THEN '" . TQ_("Sequential") . "' ELSE '". TQ_("Random") . "' END as random_select,
|
||||
CASE WHEN q.answering_machine_messages = 0 THEN '" . TQ_("Never") . "' ELSE q.answering_machine_messages END as answering_machine_messages,
|
||||
CASE WHEN q.allow_new = 0 THEN '" . TQ_("No") . "' ELSE '".TQ_("Yes")."' END as allow_new,
|
||||
CONCAT('<a href=\"?edit=edit&questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Edit") ."</a>') as edit,
|
||||
CONCAT('<a href=\"?questionnaire_id=$questionnaire_id&rsid=', si.sample_import_id ,'\">" . TQ_("Click to unassign") ."</a>') as unassign
|
||||
FROM questionnaire_sample as q, sample_import as si
|
||||
@@ -190,7 +200,7 @@ if ($questionnaire_id != false)
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Edit"), T_("Unassign sample") ));
|
||||
xhtml_table($qs,array("description","call_max","call_attempt_max","answering_machine_messages","random_select","allow_new","edit","unassign"),array(T_("Sample"), T_("Max calls"), T_("Max call attempts"), T_("Answering machine messages"), T_("Selection type"), T_("Allow new numbers to be drawn?"), T_("Edit"), T_("Unassign sample") ));
|
||||
else
|
||||
print "<p>" . T_("No samples selected for this questionnaire") . "</p>";
|
||||
|
||||
@@ -223,6 +233,7 @@ if ($questionnaire_id != false)
|
||||
<label for="call_attempt_max"><?php echo T_("Max call attempts (0 for unlimited)"); ?></label><input type="text" name="call_attempt_max" id="call_attempt_max" value="0"/> <br/>
|
||||
<label for="answering_machine_messages"><?php echo T_("Number of answering machine messages to leave per case (0 for never)"); ?></label><input type="text" name="answering_machine_messages" id="answering_machine_messages" value="1"/> <br/>
|
||||
<label for="selecttype"><?php echo T_("Select from sample randomly? (otherwise sequentially)"); ?></label><input type="checkbox" id = "selecttype" name="selecttype" /> <br/>
|
||||
<label for="allownew"><?php echo T_("Allow new numbers to be drawn?"); ?></label><input type="checkbox" id = "allownew" name="allownew" checked="checked" /> <br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_sample" value="<?php echo T_("Add sample");?>"/></p>
|
||||
</form>
|
||||
|
||||
@@ -54,7 +54,7 @@ if (isset($_GET['availability_group']))
|
||||
else if (isset($_POST['availability_group']))
|
||||
$availability_group = intval($_POST['availability_group']);
|
||||
else
|
||||
die(T_("No availability group set"));
|
||||
die(T_("No time slot group set"));
|
||||
|
||||
|
||||
if (isset($_POST['day']))
|
||||
@@ -92,7 +92,7 @@ if (isset($_POST['day']))
|
||||
$db->CompleteTrans();
|
||||
}
|
||||
|
||||
xhtml_head(T_("Modify availability"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
xhtml_head(T_("Modify time slots"),true,array("../css/shifts.css"),array("../js/addrow-v2.js"));
|
||||
|
||||
/**
|
||||
* Display warning if timezone data not installed
|
||||
@@ -158,12 +158,12 @@ translate_array($daysofweek,array("description"));
|
||||
?>
|
||||
</table>
|
||||
<p><a onclick="addRow(); return false;" href="#"><?php echo T_("Add row"); ?></a></p>
|
||||
<p><label for="description"><?php echo T_("Availability group name"); ?>: </label><input type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to availabilities"); ?>"/></p>
|
||||
<p><label for="description"><?php echo T_("Time slot group name"); ?>: </label><input type="text" name="description" id="description" value="<?php echo $description;?>"/></p>
|
||||
<p><input type="submit" name="submit" value="<?php echo T_("Save changes to time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<form method="post" action="availabilitygroup.php">
|
||||
<p><input type="submit" name="subdel" value="<?php echo T_("Delete this availability group"); ?>"/></p>
|
||||
<p><input type="submit" name="subdel" value="<?php echo T_("Delete this time slot group"); ?>"/></p>
|
||||
<input type="hidden" name="availability_group" value="<?php echo $availability_group;?>"/>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
@@ -67,7 +67,7 @@ include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
xhtml_head(T_("Availability groups"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
xhtml_head(T_("Time slots"),true,array("../css/table.css"),array("../js/window.js"));
|
||||
|
||||
if (isset($_POST['subdel']))
|
||||
{
|
||||
@@ -109,22 +109,22 @@ $sql = "SELECT description,
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
print "<h3>" . T_("Availability groups")."</h3>";
|
||||
print "<h3>" . T_("Time slots")."</h3>";
|
||||
|
||||
print "<p>" . T_("Availability groups define periods of time of respondent availability.") . "</p>";
|
||||
print "<p>" . T_("Time slots define periods of time during particular days of the week. These are used for the availability function and also the call attempt time slot function.") . "</p>";
|
||||
|
||||
if (empty($rs))
|
||||
print "<p>" . T_("No availability groups") . "</p>";
|
||||
print "<p>" . T_("No time slots") . "</p>";
|
||||
else
|
||||
xhtml_table($rs,array("description","link"),array(T_("Availablity group"),T_("Modify")));
|
||||
xhtml_table($rs,array("description","link"),array(T_("Time slot"),T_("Modify")));
|
||||
|
||||
|
||||
//add an availablity group
|
||||
print "<h3>" . T_("Add availability group") . "</h3>";
|
||||
print "<h3>" . T_("Add time slot") . "</h3>";
|
||||
?>
|
||||
<form method="post" action="?">
|
||||
<p><label for="availability_group"><?php echo T_("Availability group name"); ?>: </label><input type="text" class="textclass" name="availability_group" id="availability_group"/></p>
|
||||
<p><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add availability group"); ?>"/>
|
||||
<p><label for="availability_group"><?php echo T_("Time slot name"); ?>: </label><input type="text" class="textclass" name="availability_group" id="availability_group"/></p>
|
||||
<p><input class="submitclass" type="submit" name="submit" value="<?php echo T_("Add time slot"); ?>"/>
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
@@ -96,7 +96,8 @@ function case_status_report($questionnaire_id = false, $sample_id = false, $outc
|
||||
JOIN questionnaire as q ON (q.questionnaire_id = c.questionnaire_id and q.enabled = 1)
|
||||
JOIN outcome as o ON (o.outcome_id = c.current_outcome_id AND o.outcome_type_id = 1)
|
||||
JOIN sample as s ON (s.sample_id = c.sample_id $s)
|
||||
JOIN sample_import as si ON (s.import_id = si.sample_import_id)
|
||||
JOIN sample_import as si ON (s.import_id = si.sample_import_id AND si.enabled = 1)
|
||||
JOIN questionnaire_sample as qs ON (qs.questionnaire_id = q.questionnaire_id AND qs.sample_import_id = s.import_id)
|
||||
LEFT JOIN `call` as ca ON (ca.call_id = c.last_call_id)
|
||||
LEFT JOIN outcome as co ON (co.outcome_id = ca.outcome_id)
|
||||
LEFT JOIN case_queue as cq ON (cq.case_id = c.case_id)
|
||||
@@ -207,7 +208,7 @@ $outcome_id = false;
|
||||
print "<label for='questionnaire'>" . T_("Questionnaire") . ":</label>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
print "<label for='sample'>" . T_("Sample") . ":</label>";
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id,false);
|
||||
|
||||
if ($questionnaire_id)
|
||||
case_status_report($questionnaire_id,$sample_import_id,$outcome_id);
|
||||
|
||||
@@ -53,6 +53,7 @@ include("../include/ckeditor/ckeditor.php");
|
||||
global $db;
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
if (isset($_POST['information']))
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@ if ($a)
|
||||
<?php } ?>
|
||||
<p><?php echo T_("Enter the first name of a client to add:"); ?> <input name="firstname" type="text"/></p>
|
||||
<p><?php echo T_("Enter the surname of a client to add:"); ?> <input name="lastname" type="text"/></p>
|
||||
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
|
||||
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of a client to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?> </p>
|
||||
<p><input type="submit" value="<?php echo T_("Add user"); ?>" /></p>
|
||||
</form>
|
||||
|
||||
|
||||
@@ -70,8 +70,10 @@ print "<li><a href=\"?page=operatorquestionnaire.php\">" . T_("Assign operators
|
||||
print "<li><a href=\"?page=operatorskill.php\">" . T_("Modify operator skills") . "</a></li></ul></li>";
|
||||
|
||||
print "<li><h3>" . T_("Availability and shift management") . "</h3><ul>";
|
||||
print "<li><a href=\"?page=availabilitygroup.php\">" . T_("Manage availablity groups") . "</a></li>";
|
||||
print "<li><a href=\"?page=availabilitygroup.php\">" . T_("Manage time slots") . "</a></li>";
|
||||
print "<li><a href=\"?page=questionnaireavailability.php\">" . T_("Assign availabilities to questionnaires") . "</a></li>";
|
||||
print "<li><a href=\"?page=questionnairecatimeslots.php\">" . T_("Assign call attempt time slots to questionnaire") . "</a></li>";
|
||||
print "<li><a href=\"?page=questionnairecatimeslotssample.php\">" . T_("Assign call attempt time slots to questionnaire sample") . "</a></li>";
|
||||
print "<li><a href=\"?page=addshift.php\">" . T_("Shift management (add/remove)") . "</a></li></ul></li>";
|
||||
|
||||
print "<li><h3>" . T_("Questionnaire progress") . "</h3>";
|
||||
|
||||
@@ -158,8 +158,7 @@ else
|
||||
<?php
|
||||
$sql = "SELECT s.sid as sid, sl.surveyls_title AS title
|
||||
FROM " . LIME_PREFIX . "surveys AS s
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id
|
||||
AND sl.surveyls_language = 'en' )
|
||||
LEFT JOIN " . LIME_PREFIX . "surveys_languagesettings AS sl ON ( s.sid = sl.surveyls_survey_id)
|
||||
WHERE s.active = 'Y'";
|
||||
|
||||
$surveys = $db->GetAll($sql);
|
||||
@@ -173,6 +172,7 @@ if (!empty($surveys))
|
||||
}
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
|
||||
array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"),
|
||||
|
||||
@@ -255,9 +255,9 @@ if (isset($_GET['operator_id']))
|
||||
header("Pragma: public"); // HTTP/1.0
|
||||
|
||||
if (isset($_GET['winbat']))
|
||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
echo "voipclient.exe -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
else
|
||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['extension_password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
echo "./voipclient -i -u {$rs['ext']} -p {$rs['password']} -h " . $_SERVER['SERVER_NAME'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ if (isset($_POST['operator']))
|
||||
if (FREEPBX_PATH !== false)
|
||||
{
|
||||
//add extension
|
||||
$sql = "INSERT INTO extension (`extension`,`extension_password`,`current_operator_id`)
|
||||
$sql = "INSERT INTO extension (`extension`,`password`,`current_operator_id`)
|
||||
VALUES ($extension, $extensionp, $oid)";
|
||||
|
||||
$db->Execute($sql);
|
||||
@@ -211,7 +211,7 @@ $ers = $db->GetAll($sql);
|
||||
<?php } ?>
|
||||
<p><?php echo T_("Enter the first name of an operator to add:"); ?> <input name="firstname" type="text"/></p>
|
||||
<p><?php echo T_("Enter the surname of an operator to add:"); ?> <input name="lastname" type="text"/></p>
|
||||
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of an operator to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",DEFAULT_TIME_ZONE)); ?> </p>
|
||||
<p><a href='timezonetemplate.php'><?php echo T_("Enter the Time Zone of an operator to add:"); echo "</a>"; display_chooser($rs,"Time_zone_name","Time_zone_name",false,false,false,false,array("value",get_setting("DEFAULT_TIME_ZONE"))); ?> </p>
|
||||
<?php if (FREEPBX_PATH == false) { ?>
|
||||
<p><a href='extensionstatus.php'><?php echo T_("Select an extension for this operator:"); echo "</a>"; display_chooser($ers,"extension_id","extension_id",true,false,false,false); ?> </p>
|
||||
<?php } ?>
|
||||
|
||||
@@ -91,7 +91,10 @@ $questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Assign availability group to questionnaire"),true,false,array("../js/window.js"));
|
||||
print "<h1>" . T_("Select a questionnaire from the list below") . "</h1>";
|
||||
|
||||
print "<p>" . T_("Assigning an availability group to a questionnaire will allow interviewers to select from those groups to restrict calls to a particular case to the times within the group") ."</p>";
|
||||
|
||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
|
||||
@@ -143,7 +146,7 @@ if ($questionnaire_id != false)
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_availability" value="Add availability group"/></p>
|
||||
<input type="submit" name="add_availability" value="<?php echo TQ_("Add availability group") ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
157
admin/questionnairecatimeslots.php
Normal file
157
admin/questionnairecatimeslots.php
Normal file
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign call attempt time slots to a questionnaire
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_timeslot(questionnaire_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$availability_group')";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$availability_group = bigintval($_GET['ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Assign call attempt time slots to questionnaire"),true,false,array("../js/window.js"));
|
||||
|
||||
print "<p>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</p>";
|
||||
|
||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description
|
||||
FROM questionnaire_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h2>" . T_("There are no call attempt time slots selected for this questionnaire") . "</h2>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h2>" . T_("Call attempt time slots selected for this questionnaire") . "</h2>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<p><a href=\"?questionnaire_id=$questionnaire_id&ravailability_group={$q['availability_group_id']}\">{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")</a></p>";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_timeslot as q ON (q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
|
||||
|
||||
print "<h2>" . T_("Add a call attempt time slot to this questionnaire:") . "</h2>";
|
||||
?>
|
||||
<form action="" method="get">
|
||||
<p><label for="availability_group"><?php echo T_("Select call attempt time slot:"); ?></label><select name="availability_group" id="availability_group">
|
||||
<?php
|
||||
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="submit" name="add_availability" value="<?php echo TQ_("Add call attempt time slot") ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
?>
|
||||
172
admin/questionnairecatimeslotssample.php
Normal file
172
admin/questionnairecatimeslotssample.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* Assign call attempt time slots to a questionnaire sample
|
||||
*
|
||||
*
|
||||
* This file is part of queXS
|
||||
*
|
||||
* queXS is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* queXS is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with queXS; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*
|
||||
* @author Adam Zammit <adam.zammit@acspri.org.au>
|
||||
* @copyright Australian Consortium for Social and Political Research Inc (ACSPRI) 2011
|
||||
* @package queXS
|
||||
* @subpackage admin
|
||||
* @link http://www.acspri.org.au queXS was writen for ACSPRI
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Configuration file
|
||||
*/
|
||||
include("../config.inc.php");
|
||||
|
||||
/**
|
||||
* Database file
|
||||
*/
|
||||
include ("../db.inc.php");
|
||||
|
||||
/**
|
||||
* XHTML functions
|
||||
*/
|
||||
include("../functions/functions.xhtml.php");
|
||||
|
||||
/**
|
||||
* Display functions
|
||||
*/
|
||||
include("../functions/functions.display.php");
|
||||
|
||||
/**
|
||||
* Input functions
|
||||
*/
|
||||
include("../functions/functions.input.php");
|
||||
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['availability_group']))
|
||||
{
|
||||
//need to add availability_group to questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['availability_group']);
|
||||
|
||||
$sql = "INSERT INTO questionnaire_sample_timeslot (questionnaire_id,sample_import_id,availability_group_id)
|
||||
VALUES('$questionnaire_id','$sample_import_id','$availability_group')";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
}
|
||||
|
||||
if (isset($_GET['questionnaire_id']) && isset($_GET['sample_import_id']) && isset($_GET['ravailability_group']))
|
||||
{
|
||||
//need to remove rsid from questionnaire
|
||||
|
||||
$questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
$sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
$availability_group = bigintval($_GET['ravailability_group']);
|
||||
|
||||
$sql = "DELETE FROM questionnaire_sample_timeslot
|
||||
WHERE questionnaire_id = '$questionnaire_id'
|
||||
AND sample_import_id = '$sample_import_id'
|
||||
AND availability_group_id = '$availability_group'";
|
||||
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
|
||||
|
||||
$questionnaire_id = false;
|
||||
if (isset($_GET['questionnaire_id'])) $questionnaire_id = bigintval($_GET['questionnaire_id']);
|
||||
|
||||
xhtml_head(T_("Assign call attempt time slots to questionnaire sample"),true,false,array("../js/window.js"));
|
||||
|
||||
print "<p>" . T_("Assigning call attempt time slots to questionnaires will only allow cases to be attempted in a time slot for the n + 1th time where it has been attempted at least n times in all assigned timeslots. Please note timeslots must cover all possible time periods otherwise no cases will be available during missing timeslots.") ."</p>";
|
||||
|
||||
print "<h3>" . T_("Select a questionnaire from the list below") . "</h3>";
|
||||
display_questionnaire_chooser($questionnaire_id);
|
||||
|
||||
|
||||
if ($questionnaire_id != false)
|
||||
{
|
||||
print "<h3>" . T_("Select a sample from the list below") . "</h3>";
|
||||
|
||||
$sample_import_id = false;
|
||||
if (isset($_GET['sample_import_id'])) $sample_import_id = bigintval($_GET['sample_import_id']);
|
||||
display_sample_chooser($questionnaire_id,$sample_import_id);
|
||||
|
||||
if ($sample_import_id !== false)
|
||||
{
|
||||
|
||||
$sql = "SELECT q.availability_group_id,a.description as description
|
||||
FROM questionnaire_sample_timeslot as q, availability_group as a
|
||||
WHERE q.availability_group_id = a.availability_group_id
|
||||
AND q.questionnaire_id = '$questionnaire_id'
|
||||
AND q.sample_import_id = '$sample_import_id'";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (empty($qs))
|
||||
{
|
||||
print "<h2>" . T_("There are no call attempt time slots selected for this questionnaire sample") . "</h2>";
|
||||
}
|
||||
else
|
||||
{
|
||||
print "<h2>" . T_("Call attempt time slots selected for this questionnaire sample") . "</h2>";
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<p><a href=\"?sample_import_id=$sample_import_id&questionnaire_id=$questionnaire_id&ravailability_group={$q['availability_group_id']}\">{$q['availability_group_id']} - {$q['description']} (" . T_("Click to unassign") . ")</a></p>";
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT si.availability_group_id,si.description
|
||||
FROM availability_group as si
|
||||
LEFT JOIN questionnaire_sample_timeslot as q ON (q.sample_import_id = '$sample_import_id' AND q.questionnaire_id = '$questionnaire_id' AND q.availability_group_id = si.availability_group_id)
|
||||
WHERE q.questionnaire_id is NULL";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
if (!empty($qs))
|
||||
{
|
||||
|
||||
|
||||
print "<h2>" . T_("Add a call attempt time slot to this questionnaire sample:") . "</h2>";
|
||||
?>
|
||||
<form action="" method="get">
|
||||
<p><label for="availability_group"><?php echo T_("Select call attempt time slot:"); ?></label><select name="availability_group" id="availability_group">
|
||||
<?php
|
||||
|
||||
foreach($qs as $q)
|
||||
{
|
||||
print "<option value=\"{$q['availability_group_id']}\">{$q['description']}</option>";
|
||||
}
|
||||
|
||||
?>
|
||||
</select><br/>
|
||||
<input type="hidden" name="questionnaire_id" value="<?php print($questionnaire_id); ?>"/>
|
||||
<input type="hidden" name="sample_import_id" value="<?php print($sample_import_id); ?>"/>
|
||||
<input type="submit" name="add_availability" value="<?php echo TQ_("Add call attempt time slot") ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
xhtml_foot();
|
||||
|
||||
|
||||
?>
|
||||
@@ -298,6 +298,7 @@ if (isset($_GET['modify']))
|
||||
$questionnaire_id = intval($_GET['modify']);
|
||||
|
||||
$CKEditor = new CKEditor();
|
||||
$CKEditor->basePath = "../include/ckeditor/";
|
||||
|
||||
$ckeditorConfig = array("toolbar" => array(array("tokens","-","Source"),
|
||||
array("Cut","Copy","Paste","PasteText","PasteFromWord","-","Print","SpellChecker"),
|
||||
|
||||
@@ -319,7 +319,30 @@ if ($case_id != false)
|
||||
translate_array($rs,array("des"));
|
||||
xhtml_table($rs,array("start","des","phone","link","firstName"),array(T_("Date/Time"),T_("Outcome"),T_("Phone number"),T_("Change outcome"),T_("Operator")));
|
||||
}
|
||||
|
||||
|
||||
//view timeslots
|
||||
$sql = "SELECT count(*)
|
||||
FROM questionnaire_timeslot as q, `case` as c
|
||||
WHERE c.case_id = $case_id
|
||||
AND c.questionnaire_id = q.questionnaire_id";
|
||||
|
||||
if ($db->GetOne($sql) >= 1)
|
||||
{
|
||||
print "<h3>" . T_("Call attempts by timeslot") . "</h3>";
|
||||
|
||||
$sql = "SELECT ag.description, (SELECT COUNT(*) FROM availability as a, `call_attempt` as ca WHERE ca.case_id = c.case_id AND a.availability_group_id = ag.availability_group_id
|
||||
AND (a.day_of_week = DAYOFWEEK(CONVERT_TZ(ca.start,'UTC',s.Time_zone_name))
|
||||
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) >= a.start
|
||||
AND TIME(CONVERT_TZ(ca.start, 'UTC' , s.Time_zone_name)) <= a.end)) as cou
|
||||
FROM availability_group as ag, `case` as c, `questionnaire_timeslot` as qt, sample as s
|
||||
WHERE c.case_id = '$case_id'
|
||||
AND s.sample_id = c.sample_id
|
||||
AND qt.questionnaire_id = c.questionnaire_id AND ag.availability_group_id = qt.availability_group_id";
|
||||
|
||||
xhtml_table($db->GetAll($sql),array('description','cou'),array(T_("Time slot"),T_("Call attempts")));
|
||||
|
||||
}
|
||||
|
||||
//view notes
|
||||
$sql = "SELECT DATE_FORMAT(CONVERT_TZ(c.datetime,'UTC',op.Time_zone_name),'".DATE_TIME_FORMAT."') as time, op.firstName, op.lastName, c.note as note, CONCAT('<a href=\'?case_id=$case_id&case_note_id=', c.case_note_id, '\'>". TQ_("Delete") . "</a>') as link
|
||||
FROM `case_note` as c
|
||||
@@ -418,7 +441,6 @@ if ($case_id != false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
//assign this to an operator for their next case
|
||||
print "<h3>" . T_("Assign this case to operator (will appear as next case for them)") . "</h3>";
|
||||
?>
|
||||
|
||||
@@ -88,8 +88,11 @@ register_shutdown_function('disable_systemsort');
|
||||
//all output send to database instead of stdout
|
||||
ob_start('update_callback',2);
|
||||
|
||||
$closecasescounter = 0;
|
||||
|
||||
print T_("Sorting cases process starting");
|
||||
|
||||
$closecasesinterval = (24 * 60) / SYSTEM_SORT_MINUTES; //check for closed cases once every day
|
||||
$sleepinterval = 10; // in seconds so we can monitor if the process has been killed
|
||||
|
||||
while (!is_process_killed($process_id)) //check if process killed every $sleepinterval
|
||||
@@ -97,202 +100,232 @@ while (!is_process_killed($process_id)) //check if process killed every $sleepin
|
||||
//Make sure that the system knows we are system sorting
|
||||
set_setting('systemsort',true);
|
||||
|
||||
print T_("Sorting cases");
|
||||
if ($closecasescounter == 0 || $closecasescounter > $closecasesinterval)
|
||||
{
|
||||
$time_start = microtime(true);
|
||||
print T_("Checking for cases open for more than 24 hours");
|
||||
|
||||
$time_start = microtime(true);
|
||||
$closecasescounter = 0;
|
||||
$db->StartTrans();
|
||||
|
||||
$db->StartTrans();
|
||||
//find all call attempts without an end that started more than 24 hours ago
|
||||
|
||||
$sql = "SELECT case_id, call_attempt_id
|
||||
FROM `call_attempt`
|
||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||
AND end IS NULL";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
//refer to supervisor if case still assigned
|
||||
|
||||
$sql = "UPDATE `case`
|
||||
SET current_operator_id = NULL, current_outcome_id = 5
|
||||
WHERE case_id = '{$r['case_id']}'
|
||||
AND current_operator_id IS NOT NULL
|
||||
AND current_call_id IS NULL";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//add note
|
||||
|
||||
//find all call attempts without an end that started more than 24 hours ago
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
|
||||
$sql = "SELECT case_id, call_attempt_id
|
||||
FROM `call_attempt`
|
||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||
AND end IS NULL";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
//refer to supervisor if case still assigned
|
||||
|
||||
$sql = "UPDATE `case`
|
||||
SET current_operator_id = NULL, current_outcome_id = 5
|
||||
WHERE case_id = '{$r['case_id']}'
|
||||
AND current_operator_id IS NOT NULL
|
||||
AND current_call_id IS NULL";
|
||||
$db->Execute($sql);
|
||||
|
||||
//finish the call attempt
|
||||
|
||||
$sql = "UPDATE `call_attempt`
|
||||
SET end = start
|
||||
WHERE call_attempt_id = '{$r['call_attempt_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
$db->Execute($sql);
|
||||
|
||||
//add note
|
||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||
}
|
||||
|
||||
//find all calls without an end that started more than 24 hours ago
|
||||
|
||||
$sql = "SELECT case_id, call_id
|
||||
FROM `call`
|
||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||
AND end IS NULL";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
//refer to supervisor if case still assigned
|
||||
|
||||
$sql = "UPDATE `case`
|
||||
SET current_operator_id = NULL, current_outcome_id = 5, current_call_id = NULL
|
||||
WHERE case_id = '{$r['case_id']}'
|
||||
AND current_operator_id IS NOT NULL";
|
||||
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
$db->Execute($sql);
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
//finish the call attempt
|
||||
|
||||
$sql = "UPDATE `call_attempt`
|
||||
SET end = start
|
||||
WHERE call_attempt_id = '{$r['call_attempt_id']}'";
|
||||
//add note
|
||||
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
|
||||
$db->Execute($sql);
|
||||
$db->Execute($sql);
|
||||
|
||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||
}
|
||||
|
||||
//find all calls without an end that started more than 24 hours ago
|
||||
|
||||
$sql = "SELECT case_id, call_id
|
||||
FROM `call`
|
||||
WHERE TIMESTAMPDIFF(HOUR, start, CONVERT_TZ(NOW(),'System','UTC')) > 24
|
||||
AND end IS NULL";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
//refer to supervisor if case still assigned
|
||||
|
||||
$sql = "UPDATE `case`
|
||||
SET current_operator_id = NULL, current_outcome_id = 5, current_call_id = NULL
|
||||
WHERE case_id = '{$r['case_id']}'
|
||||
AND current_operator_id IS NOT NULL";
|
||||
//finish the call
|
||||
|
||||
$sql = "UPDATE `call`
|
||||
SET end = start, outcome_id = 5, state = 5
|
||||
WHERE call_id = '{$r['call_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
$db->Execute($sql);
|
||||
|
||||
//add note
|
||||
|
||||
$sql = "INSERT INTO case_note (case_id,operator_id,note,`datetime`)
|
||||
VALUES ('{$r['case_id']}',1,'" . TQ_("System automatically closed case as not closed for more than 24 hours") ."', CONVERT_TZ(NOW(),'System','UTC'))";
|
||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||
}
|
||||
|
||||
$db->Execute($sql);
|
||||
$result = $db->CompleteTrans();
|
||||
|
||||
$time_end = microtime(true);
|
||||
$timer = $time_end - $time_start;
|
||||
|
||||
//finish the call
|
||||
|
||||
$sql = "UPDATE `call`
|
||||
SET end = start, outcome_id = 5, state = 5
|
||||
WHERE call_id = '{$r['call_id']}'";
|
||||
if ($result)
|
||||
print T_("Completed case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
else
|
||||
print T_("Failed to complete case closing") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
}
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
print T_("System automatically closed case as not closed for more than 24 hours") . " - " . T_("Case id") . ": {$r['case_id']}";
|
||||
}
|
||||
|
||||
|
||||
//Set all cases as unavailable
|
||||
$sql = "UPDATE `case`
|
||||
SET sortorder = NULL
|
||||
WHERE 1";
|
||||
$closecasescounter++;
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
|
||||
//Update quotas for all enabled questionnaires
|
||||
$sql = "SELECT questionnaire_id
|
||||
//Sort cases on a questionnaire by questionnaire basis
|
||||
$sql = "SELECT questionnaire_id, description
|
||||
FROM questionnaire
|
||||
WHERE enabled = 1";
|
||||
|
||||
$qs = $db->GetAll($sql);
|
||||
|
||||
foreach($qs as $q)
|
||||
update_quotas($q['questionnaire_id']);
|
||||
{
|
||||
print T_("Sorting cases for ") . $q['description'];
|
||||
|
||||
$questionnaire_id = $q['questionnaire_id'];
|
||||
|
||||
$time_start = microtime(true);
|
||||
|
||||
$db->StartTrans();
|
||||
|
||||
//Set all cases as unavailable
|
||||
$sql = "UPDATE `case`
|
||||
SET sortorder = NULL
|
||||
WHERE sortorder IS NOT NULL
|
||||
AND questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
|
||||
|
||||
//update quotas
|
||||
update_quotas($questionnaire_id);
|
||||
|
||||
|
||||
//Sort current cases for all enabled questionnaires
|
||||
//Sort current cases for this questionnaire
|
||||
|
||||
|
||||
$sql = "SELECT c.case_id
|
||||
FROM `case` as c
|
||||
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
||||
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and ou.outcome_id = c.current_outcome_id and q.enabled = 1 and qs.questionnaire_id = c.questionnaire_id)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
||||
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||
WHERE c.current_operator_id IS NULL
|
||||
AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ap.case_id is NULL
|
||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max))
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||
GROUP BY c.case_id
|
||||
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, a.start ASC, qsep.priority DESC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
$sql = "SELECT c.case_id
|
||||
FROM `case` as c
|
||||
LEFT JOIN `call` as a on (a.call_id = c.last_call_id)
|
||||
JOIN (sample as s, sample_import as si) on (s.sample_id = c.sample_id and si.sample_import_id = s.import_id)
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, outcome as ou) on (c.questionnaire_id = q.questionnaire_id and qs.sample_import_id = s.import_id and ou.outcome_id = c.current_outcome_id and q.questionnaire_id = '$questionnaire_id' and qs.questionnaire_id = c.questionnaire_id)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN appointment as ap on (ap.case_id = c.case_id AND ap.completed_call_id is NULL AND (ap.start > CONVERT_TZ(NOW(),'System','UTC')))
|
||||
LEFT JOIN appointment as apn on (apn.case_id = c.case_id AND apn.completed_call_id is NULL AND (CONVERT_TZ(NOW(),'System','UTC') >= apn.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= apn.end))
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||
LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id)
|
||||
LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id)
|
||||
WHERE c.current_operator_id IS NULL
|
||||
AND c.questionnaire_id = '$questionnaire_id'
|
||||
AND ((apn.appointment_id IS NOT NULL) OR casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||
AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ap.case_id is NULL
|
||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_attempt_max = 0 or ((SELECT count(*) FROM call_attempt WHERE case_id = c.case_id) < qs.call_attempt_max))
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||
GROUP BY c.case_id
|
||||
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, a.start ASC";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$i = 1;
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
$sql = "UPDATE `case`
|
||||
SET sortorder = '$i'
|
||||
WHERE case_id = '{$r['case_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
$i++;
|
||||
}
|
||||
$i = 1;
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
$sql = "UPDATE `case`
|
||||
SET sortorder = '$i'
|
||||
WHERE case_id = '{$r['case_id']}'";
|
||||
|
||||
$db->Execute($sql);
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
//First set all sample records as unavailable
|
||||
$sql = "UPDATE `questionnaire_sample_exclude_priority`
|
||||
SET sortorder = NULL
|
||||
WHERE 1";
|
||||
//First set all sample records as unavailable
|
||||
$sql = "UPDATE `questionnaire_sample_exclude_priority`
|
||||
SET sortorder = NULL
|
||||
WHERE sortorder IS NOT NULL
|
||||
AND questionnaire_id = '$questionnaire_id'";
|
||||
|
||||
$db->Execute($sql);
|
||||
$db->Execute($sql);
|
||||
|
||||
|
||||
//Sort sample list where attached to this questionnaire
|
||||
|
||||
//Sort sample list where attached to an enabled questionnaire
|
||||
$sql = "SELECT s.sample_id as sample_id,qs.questionnaire_id as questionnaire_id
|
||||
FROM sample as s
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, sample_import as si) on (qs.sample_import_id = s.import_id and si.sample_import_id = s.import_id and q.questionnaire_id = qs.questionnaire_id AND q.questionnaire_id = '$questionnaire_id' AND qs.allow_new = 1)
|
||||
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = qs.questionnaire_id AND qsep.sample_id = s.sample_id)
|
||||
WHERE c.case_id is NULL
|
||||
AND ((qsep.questionnaire_id IS NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||
GROUP BY s.sample_id,qs.questionnaire_id
|
||||
ORDER BY qsep.priority DESC, rand() * qs.random_select, s.sample_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$sql = "SELECT s.sample_id as sample_id,qs.questionnaire_id as questionnaire_id
|
||||
FROM sample as s
|
||||
JOIN (questionnaire_sample as qs, questionnaire as q, sample_import as si) on (qs.sample_import_id = s.import_id and si.sample_import_id = s.import_id and q.questionnaire_id = qs.questionnaire_id AND q.enabled = 1)
|
||||
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = qs.questionnaire_id AND qsep.sample_id = s.sample_id)
|
||||
WHERE c.case_id is NULL
|
||||
AND ((qsep.questionnaire_id IS NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL)
|
||||
AND !(si.call_restrict = 1 AND cr.day_of_week IS NULL)
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = qs.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||
GROUP BY s.sample_id,qs.questionnaire_id
|
||||
ORDER BY qsep.priority DESC, rand() * qs.random_select, s.sample_id";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
$i = 1;
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
$sql = "INSERT INTO questionnaire_sample_exclude_priority (questionnaire_id,sample_id,exclude,priority,sortorder)
|
||||
VALUES ('{$r['questionnaire_id']}', '{$r['sample_id']}', 0, 50,'$i')
|
||||
ON DUPLICATE KEY UPDATE sortorder = '$i'";
|
||||
|
||||
$i = 1;
|
||||
foreach ($rs as $r)
|
||||
{
|
||||
$sql = "INSERT INTO questionnaire_sample_exclude_priority (questionnaire_id,sample_id,exclude,priority,sortorder)
|
||||
VALUES ('{$r['questionnaire_id']}', '{$r['sample_id']}', 0, 50,'$i')
|
||||
ON DUPLICATE KEY UPDATE sortorder = '$i'";
|
||||
$db->Execute($sql);
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$db->Execute($sql);
|
||||
$i++;
|
||||
}
|
||||
|
||||
|
||||
$result = $db->CompleteTrans();
|
||||
|
||||
$time_end = microtime(true);
|
||||
$timer = $time_end - $time_start;
|
||||
|
||||
|
||||
$result = $db->CompleteTrans();
|
||||
|
||||
$time_end = microtime(true);
|
||||
$timer = $time_end - $time_start;
|
||||
|
||||
if ($result)
|
||||
print T_("Completed sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
else
|
||||
print T_("Failed to complete sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
if ($result)
|
||||
print T_("Completed sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
else
|
||||
print T_("Failed to complete sort") . ". " . T_("This task took") . ": $timer " . T_("seconds");
|
||||
}
|
||||
|
||||
for ($i = 0; $i < (SYSTEM_SORT_MINUTES * 60); $i += $sleepinterval)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,11 @@ include("../functions/functions.input.php");
|
||||
global $db;
|
||||
|
||||
|
||||
if (isset($_POST['dtime_zone']))
|
||||
{
|
||||
set_setting('DEFAULT_TIME_ZONE', $_POST['dtime_zone']);
|
||||
}
|
||||
|
||||
if (isset($_GET['time_zone']))
|
||||
{
|
||||
//need to add sample to questionnaire
|
||||
@@ -86,8 +91,10 @@ if (isset($_GET['tz']))
|
||||
|
||||
xhtml_head(T_("Add/Remove Timezones"),true,array("../css/shifts.css"),array("../js/window.js"));
|
||||
|
||||
$dtz = get_setting("DEFAULT_TIME_ZONE");
|
||||
|
||||
$sql = "SELECT name as value, name as description,
|
||||
CASE WHEN name LIKE '" . DEFAULT_TIME_ZONE . "' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
CASE WHEN name LIKE '$dtz' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM mysql.time_zone_name";
|
||||
|
||||
$tzl = $db->GetAll($sql);
|
||||
@@ -97,6 +104,13 @@ if (empty($tzl) || !$tzl)
|
||||
print "<div class='warning'><a href='http://dev.mysql.com/doc/mysql/en/time-zone-support.html'>" . T_("Your database does not have timezones installed, please see here for details") . "</a></div>";
|
||||
}
|
||||
|
||||
print "<h1>" . T_("Set default timezone") . ": </h1>";
|
||||
?>
|
||||
<form action="" method="post"><p>
|
||||
<label for="dtime_zone"><?php echo T_("Default Timezone: "); ?></label><?php display_chooser($tzl, 'dtime_zone', 'dtime_zone', false, false, false, false, false); ?>
|
||||
<input type="submit" name="set_dtimezone" value="<?php echo T_("Set default timezone"); ?>"/></p>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
print "<h1>" . T_("Click to remove a Timezone from the default list") . "</h1>";
|
||||
|
||||
|
||||
@@ -40,12 +40,6 @@
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* The default time zone
|
||||
*/
|
||||
if (!defined('DEFAULT_TIME_ZONE')) define('DEFAULT_TIME_ZONE', 'Australia/Victoria');
|
||||
|
||||
|
||||
/**
|
||||
* Date time format for displaying
|
||||
*
|
||||
@@ -94,6 +88,12 @@ if (!defined('VOIP_ADMIN_PASS')) define('VOIP_ADMIN_PASS','amp111');
|
||||
*/
|
||||
if (!defined('VOIP_PORT')) define('VOIP_PORT','5038');
|
||||
|
||||
/**
|
||||
* The Asterisk context to originate calls from (in FreePBX this should be
|
||||
* 'from-internal' otherwise try 'default'
|
||||
*/
|
||||
if (!defined('ORIGINATE_CONTEXT')) define('ORIGINATE_CONTEXT','from-internal');
|
||||
|
||||
/**
|
||||
* The freepbx root path (if installed) otherwise false to disable freepbx integration
|
||||
*/
|
||||
|
||||
@@ -38,11 +38,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* The default time zone
|
||||
*/
|
||||
define('DEFAULT_TIME_ZONE', 'Australia/Victoria');
|
||||
|
||||
/**
|
||||
* Flag for VoIP with Asterisk to be enabled or not
|
||||
*/
|
||||
|
||||
@@ -1479,6 +1479,7 @@ CREATE TABLE `questionnaire_sample` (
|
||||
`call_attempt_max` int(11) NOT NULL default '0',
|
||||
`random_select` tinyint(1) NOT NULL default '0',
|
||||
`answering_machine_messages` int(11) NOT NULL default '1',
|
||||
`allow_new` TINYINT( 1 ) NOT NULL DEFAULT '1',
|
||||
PRIMARY KEY (`questionnaire_id`,`sample_import_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
|
||||
|
||||
@@ -1579,6 +1580,22 @@ CREATE TABLE `questionnaire_sample_quota_row_exclude` (
|
||||
-- Dumping data for table `questionnaire_sample_quota_row_exclude`
|
||||
--
|
||||
|
||||
CREATE TABLE `questionnaire_sample_timeslot` (
|
||||
`questionnaire_id` bigint( 20 ) NOT NULL ,
|
||||
`sample_import_id` bigint( 20 ) NOT NULL ,
|
||||
`availability_group_id` bigint( 20 ) NOT NULL ,
|
||||
PRIMARY KEY ( `questionnaire_id` , `availability_group_id` , `sample_import_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
CREATE TABLE `questionnaire_timeslot` (
|
||||
`questionnaire_id` bigint( 20 ) NOT NULL ,
|
||||
`availability_group_id` bigint( 20 ) NOT NULL ,
|
||||
PRIMARY KEY ( `questionnaire_id` , `availability_group_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
@@ -1805,6 +1822,10 @@ CREATE TABLE `setting` (
|
||||
-- Dumping data for table `setting`
|
||||
--
|
||||
|
||||
INSERT INTO `setting` (`setting_id`, `field`, `value`) VALUES
|
||||
(1, 'DEFAULT_TIME_ZONE', 's:18:"Australia/Victoria";'),
|
||||
(2, 'systemsort', 'b:0;');
|
||||
|
||||
|
||||
-- --------------------------------------------------------
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ function display_respondent_form($respondent_id = false,$case_id = false)
|
||||
/**
|
||||
* Use the default time zone if none other to work with
|
||||
*/
|
||||
$rzone = DEFAULT_TIME_ZONE;
|
||||
$rzone = get_setting("DEFAULT_TIME_ZONE");
|
||||
$fn = "";
|
||||
$ln = "";
|
||||
|
||||
|
||||
@@ -119,15 +119,21 @@ function display_shift_chooser($questionnaire_id, $shift_id = false)
|
||||
*
|
||||
* @param int $questionnaire_id The questionnaire id
|
||||
* @param int|bool $sample_import_id The sample import id or false if none selected
|
||||
* @param bool $disabled Display disabled samples? (default is true)
|
||||
*/
|
||||
function display_sample_chooser($questionnaire_id, $sample_import_id = false)
|
||||
function display_sample_chooser($questionnaire_id, $sample_import_id = false, $disabled = true)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$s = "";
|
||||
|
||||
if (!$disabled)
|
||||
$s = " AND si.enabled = 1 ";
|
||||
|
||||
$sql = "SELECT s.sample_import_id,si.description,CASE WHEN s.sample_import_id = '$sample_import_id' THEN 'selected=\'selected\'' ELSE '' END AS selected
|
||||
FROM questionnaire_sample as s, sample_import as si
|
||||
WHERE s.questionnaire_id = '$questionnaire_id'
|
||||
AND s.sample_import_id = si.sample_import_id";
|
||||
AND s.sample_import_id = si.sample_import_id $s";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
|
||||
@@ -270,7 +270,7 @@ function import_file($file, $description, $fields, $firstrow = 2)
|
||||
|
||||
//first find the timezone
|
||||
|
||||
$tzone = DEFAULT_TIME_ZONE; //set this to default
|
||||
$tzone = get_setting("DEFAULT_TIME_ZONE"); //set this to default
|
||||
|
||||
/**
|
||||
* Determine time zone from all possible sources in sample_var_type table
|
||||
|
||||
@@ -291,6 +291,16 @@ function limesurvey_quota_replicate_completions($lime_sid,$questionnaire_id,$sam
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT COUNT(*)
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = '".DB_NAME."'
|
||||
AND table_name = '" . LIME_PREFIX . "survey_$lime_sid'";
|
||||
|
||||
$rs = $db->GetOne($sql);
|
||||
|
||||
if ($rs != 1)
|
||||
return false;
|
||||
|
||||
$sql = "SELECT count(*) as c
|
||||
FROM " . LIME_PREFIX . "survey_$lime_sid as s
|
||||
JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id')
|
||||
@@ -390,6 +400,16 @@ function limesurvey_quota_completions($lime_sgqa,$lime_sid,$questionnaire_id,$sa
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT COUNT(*)
|
||||
FROM information_schema.tables
|
||||
WHERE table_schema = '".DB_NAME."'
|
||||
AND table_name = '" . LIME_PREFIX . "survey_$lime_sid'";
|
||||
|
||||
$rs = $db->GetOne($sql);
|
||||
|
||||
if ($rs != 1)
|
||||
return false;
|
||||
|
||||
$sql = "SELECT count(*) as c
|
||||
FROM " . LIME_PREFIX . "survey_$lime_sid as s
|
||||
JOIN `case` as c ON (c.questionnaire_id = '$questionnaire_id')
|
||||
@@ -412,18 +432,18 @@ function limesurvey_quota_completions($lime_sgqa,$lime_sid,$questionnaire_id,$sa
|
||||
* Based on GetQuotaInformation() from common.php in Limesurvey
|
||||
*
|
||||
* @param int $lime_quota_id The quota id to get information on
|
||||
* @param string $baselang The base language for getting information from questions
|
||||
* @return array An array containing the question information for comparison
|
||||
*/
|
||||
function get_limesurvey_quota_info($lime_quota_id,$baselang = DEFAULT_LOCALE)
|
||||
function get_limesurvey_quota_info($lime_quota_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$ret = array();
|
||||
|
||||
$sql = "SELECT *
|
||||
FROM ".LIME_PREFIX."quota_members
|
||||
WHERE quota_id='$lime_quota_id'";
|
||||
$sql = "SELECT q.*,s.language
|
||||
FROM ".LIME_PREFIX."quota_members as q, ".LIME_PREFIX."surveys as s
|
||||
WHERE q.quota_id='$lime_quota_id'
|
||||
AND s.sid = q.sid";
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
@@ -431,11 +451,12 @@ function get_limesurvey_quota_info($lime_quota_id,$baselang = DEFAULT_LOCALE)
|
||||
{
|
||||
$lime_qid = $quota_entry['qid'];
|
||||
$surveyid = $quota_entry['sid'];
|
||||
$language = $quota_entry['language'];
|
||||
|
||||
$sql = "SELECT type, title,gid
|
||||
FROM ".LIME_PREFIX."questions
|
||||
WHERE qid='$lime_qid'
|
||||
AND language='$baselang'";
|
||||
AND language='$language'";
|
||||
|
||||
$qtype = $db->GetRow($sql);
|
||||
|
||||
|
||||
@@ -367,10 +367,10 @@ function add_case($sample_id,$questionnaire_id,$operator_id = "NULL",$testing =
|
||||
$db->Execute("SET @row := 0");
|
||||
|
||||
$sql = "INSERT INTO contact_phone (case_id,priority,phone,description)
|
||||
SELECT $case_id as case_id,@row := @row + 1 AS priority,SUBSTRING_INDEX(e.extension,'/',-1) as phone, CONCAT(o.firstName, ' ', o.lastName)
|
||||
FROM operator as o, `extension` as e
|
||||
WHERE o.enabled = 1
|
||||
AND e.current_operator_id = o.operator_id";
|
||||
SELECT $case_id as case_id,@row := @row + 1 AS priority,IFNULL(SUBSTRING_INDEX(e.extension,'/',-1),'312345678') as phone, CONCAT(o.firstName, ' ', o.lastName)
|
||||
FROM operator as o
|
||||
LEFT JOIN `extension` as e ON (e.current_operator_id = o.operator_id)
|
||||
WHERE o.enabled = 1";
|
||||
|
||||
$db->Execute($sql);
|
||||
}
|
||||
@@ -609,7 +609,6 @@ function get_case_id($operator_id, $create = false)
|
||||
*
|
||||
* THINGS TO ADD:
|
||||
*
|
||||
* @todo also option of "time of day" calls - try once in the morning/etc
|
||||
* @todo also could check the respondent_not_available table to see if now is a "bad time" to call
|
||||
*/
|
||||
|
||||
@@ -625,10 +624,14 @@ function get_case_id($operator_id, $create = false)
|
||||
LEFT JOIN questionnaire_sample_exclude_priority AS qsep ON (qsep.questionnaire_id = c.questionnaire_id AND qsep.sample_id = c.sample_id)
|
||||
LEFT JOIN case_availability AS casa ON (casa.case_id = c.case_id)
|
||||
LEFT JOIN availability AS ava ON (ava.availability_group_id = casa.availability_group_id)
|
||||
LEFT JOIN questionnaire_timeslot AS qast ON (qast.questionnaire_id = c.questionnaire_id)
|
||||
LEFT JOIN questionnaire_sample_timeslot AS qasts ON (qasts.questionnaire_id = c.questionnaire_id AND qasts.sample_import_id = si.sample_import_id)
|
||||
JOIN operator_skill as os on (os.operator_id = op.operator_id and os.outcome_type_id = ou.outcome_type_id)
|
||||
WHERE c.current_operator_id IS NULL
|
||||
AND (casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ((apn.appointment_id IS NOT NULL) OR casa.case_id IS NULL OR (ava.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= ava.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= ava.end ))
|
||||
AND ((apn.appointment_id IS NOT NULL) OR qast.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qast.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_timeslot WHERE questionnaire_timeslot.questionnaire_id = c.questionnaire_id AND availability_group.availability_group_id = questionnaire_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||
AND ((apn.appointment_id IS NOT NULL) OR qasts.questionnaire_id IS NULL OR ((SELECT COUNT(*) FROM availability WHERE availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(),'System',s.Time_zone_name)) AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= availability.end)) >= 1 AND (SELECT COUNT(call_attempt_id) FROM `call_attempt`, availability WHERE call_attempt.case_id = c.case_id AND (availability.availability_group_id = qasts.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end))) = ( SELECT (SELECT COUNT(*) FROM availability, call_attempt WHERE call_attempt.case_id = c.case_id AND availability.availability_group_id = availability_group.availability_group_id AND (availability.day_of_week = DAYOFWEEK(CONVERT_TZ(call_attempt.start,'UTC',s.Time_zone_name)) AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) >= availability.start AND TIME(CONVERT_TZ(call_attempt.start, 'UTC' , s.Time_zone_name)) <= availability.end)) as cou FROM availability_group, questionnaire_sample_timeslot WHERE questionnaire_sample_timeslot.questionnaire_id = c.questionnaire_id AND questionnaire_sample_timeslot.sample_import_id = si.sample_import_id AND availability_group.availability_group_id = questionnaire_sample_timeslot.availability_group_id ORDER BY cou ASC LIMIT 1)))
|
||||
AND (a.call_id is NULL or (a.end < CONVERT_TZ(DATE_SUB(NOW(), INTERVAL ou.default_delay_minutes MINUTE),'System','UTC')))
|
||||
AND ap.case_id is NULL
|
||||
AND ((qsep.questionnaire_id is NULL) or qsep.exclude = 0)
|
||||
AND !(q.restrict_work_shifts = 1 AND sh.shift_id IS NULL AND os.outcome_type_id != 2)
|
||||
@@ -637,10 +640,10 @@ function get_case_id($operator_id, $create = false)
|
||||
AND ((apn.appointment_id IS NOT NULL) or qs.call_max = 0 or ((SELECT count(*) FROM `call` WHERE case_id = c.case_id) < qs.call_max))
|
||||
AND (apn.require_operator_id IS NULL OR apn.require_operator_id = '$operator_id')
|
||||
AND (SELECT count(*) FROM `questionnaire_sample_quota` WHERE questionnaire_id = c.questionnaire_id AND sample_import_id = s.import_id AND quota_reached = 1) = 0
|
||||
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, a.start ASC, qsep.priority DESC
|
||||
ORDER BY IF(ISNULL(apn.end),1,0),apn.end ASC, qsep.priority DESC, a.start ASC
|
||||
LIMIT 1";
|
||||
|
||||
//apn.appointment_id contains the id of an appointment if we are calling on an appointment
|
||||
|
||||
//apn.appointment_id contains the id of an appointment if we are calling on an appointment
|
||||
}
|
||||
$r2 = $db->GetRow($sql);
|
||||
|
||||
@@ -681,7 +684,7 @@ function get_case_id($operator_id, $create = false)
|
||||
|
||||
$sql = "SELECT s.sample_id as sample_id,c.case_id as case_id,qs.questionnaire_id as questionnaire_id,CONVERT_TZ(NOW(), 'System' , s.Time_zone_name) as resptime, q.testing as testing
|
||||
FROM sample as s
|
||||
JOIN (questionnaire_sample as qs, operator_questionnaire as o, questionnaire as q, operator as op, sample_import as si, operator_skill as os) on (op.operator_id = '$operator_id' and qs.sample_import_id = s.import_id and o.operator_id = op.operator_id and o.questionnaire_id = qs.questionnaire_id and q.questionnaire_id = o.questionnaire_id and si.sample_import_id = s.import_id and os.operator_id = op.operator_id and os.outcome_type_id = 1 and q.enabled = 1)
|
||||
JOIN (questionnaire_sample as qs, operator_questionnaire as o, questionnaire as q, operator as op, sample_import as si, operator_skill as os) on (op.operator_id = '$operator_id' and qs.sample_import_id = s.import_id and o.operator_id = op.operator_id and o.questionnaire_id = qs.questionnaire_id and q.questionnaire_id = o.questionnaire_id and si.sample_import_id = s.import_id and os.operator_id = op.operator_id and os.outcome_type_id = 1 and q.enabled = 1 and qs.allow_new = 1)
|
||||
LEFT JOIN `case` as c on (c.sample_id = s.sample_id and c.questionnaire_id = qs.questionnaire_id)
|
||||
LEFT JOIN call_restrict as cr on (cr.day_of_week = DAYOFWEEK(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) >= cr.start and TIME(CONVERT_TZ(NOW(), 'System' , s.Time_zone_name)) <= cr.end)
|
||||
LEFT JOIN shift as sh on (sh.questionnaire_id = q.questionnaire_id and (CONVERT_TZ(NOW(),'System','UTC') >= sh.start) AND (CONVERT_TZ(NOW(),'System','UTC') <= sh.end))
|
||||
@@ -860,12 +863,12 @@ function get_extension_password($operator_id)
|
||||
{
|
||||
global $db;
|
||||
|
||||
$sql = "SELECT e.extension_password
|
||||
$sql = "SELECT e.password
|
||||
FROM `extension` as e
|
||||
WHERE e.current_operator_id = '$operator_id'";
|
||||
|
||||
$rs = $db->GetRow($sql);
|
||||
if (!empty($rs) && isset($rs['extension_password'])) return $rs['extension_password'];
|
||||
if (!empty($rs) && isset($rs['password'])) return $rs['password'];
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,11 +71,11 @@ class voip {
|
||||
{
|
||||
$ret = $this->query("Action: IAXPeerList\r\n\r\n","PeerlistComplete");
|
||||
|
||||
$c = spliti("\r\n\r\n",$ret);
|
||||
$c = preg_split("/\r\n\r\n/i",$ret);
|
||||
$chans = array();
|
||||
foreach ($c as $s)
|
||||
{
|
||||
if(eregi("Event: PeerEntry.*ObjectName: ([0-9a-zA-Z-]+).*Status: ([/0-9a-zA-Z-]+)",$s,$regs))
|
||||
if(preg_match("{Event: PeerEntry.*ObjectName: ([0-9a-zA-Z-]+).*Status: ([/0-9a-zA-Z-]+)}is",$s,$regs))
|
||||
{
|
||||
//print T_("Channel: SIP/") . $regs[1] . " BridgedChannel " . $regs[2] . "\n";
|
||||
$chan = substr($regs[1],0,4);
|
||||
@@ -98,18 +98,18 @@ class voip {
|
||||
{
|
||||
$ret = $this->query("Action: Status\r\n\r\n","StatusComplete");
|
||||
|
||||
$c = spliti("\r\n\r\n",$ret);
|
||||
$c = preg_split("/\r\n\r\n/i",$ret);
|
||||
$chans = array();
|
||||
foreach ($c as $s)
|
||||
{
|
||||
if(eregi("Event: Status.*Channel: ((SIP/|IAX2/)[0-9a-zA-Z-]+).*BridgedChannel: ((SIP/|IAX2/)[/0-9a-zA-Z-]+)",$s,$regs))
|
||||
if(preg_match("{Event: Status.*Channel: ((SIP/|IAX2/)[0-9a-zA-Z-]+).*BridgedChannel: ((SIP/|IAX2/)[/0-9a-zA-Z-]+)}is",$s,$regs))
|
||||
{
|
||||
//print T_("Channel: SIP/") . $regs[1] . " BridgedChannel " . $regs[2] . "\n";
|
||||
$ccs = explode('-',$regs[1]);
|
||||
$chan = $ccs[0];
|
||||
$chans[$chan] = array($regs[1],$regs[3]);
|
||||
}
|
||||
else if(eregi("Event: Status.*Channel: ((SIP/|IAX2/)[0-9a-zA-Z-]+)",$s,$regs))
|
||||
else if(preg_match("{Event: Status.*Channel: ((SIP/|IAX2/)[0-9a-zA-Z-]+)}is",$s,$regs))
|
||||
{
|
||||
//print T_("Channel: ") . $regs[1] . "\n";
|
||||
$ccs = explode('-', $regs[1]);
|
||||
@@ -187,7 +187,7 @@ class voip {
|
||||
*/
|
||||
function dial($ext,$number)
|
||||
{
|
||||
$r = $this->query("Action: Originate\r\nChannel: $ext\r\nExten: $number\r\nPriority: 1\r\nCallerid: $ext\r\n\r\n","Response");
|
||||
$r = $this->query("Action: Originate\r\nChannel: $ext\r\nExten: $number\r\nContext: " . ORIGINATE_CONTEXT . "\r\nPriority: 1\r\nCallerid: $ext\r\n\r\n","Response");
|
||||
}
|
||||
|
||||
|
||||
@@ -266,7 +266,7 @@ class voip {
|
||||
if ($type == "SIP")
|
||||
{
|
||||
$ret = $this->query("Action: ExtensionState\r\nContext: from-internal\r\nExten: $ext\r\nActionID: \r\n\r\n","Status:");
|
||||
if(eregi("Status: ([0-9]+)",$ret,$regs))
|
||||
if(preg_match("{Status: ([0-9]+)}is",$ret,$regs))
|
||||
{
|
||||
if (isset($regs[1]))
|
||||
{
|
||||
@@ -540,14 +540,14 @@ class voipWatch extends voip {
|
||||
*
|
||||
*/
|
||||
if ($in == "\r\n")
|
||||
{
|
||||
{
|
||||
//print "PROCESS: ";
|
||||
/**
|
||||
* The call is ringing
|
||||
*/
|
||||
if (eregi("Event: Dial.*SubEvent: Begin.*Channel: ((SIP/|IAX2/)[0-9]+)",$line,$regs))
|
||||
{
|
||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||
if (preg_match("{Event: Dial.*SubEvent: Begin.*Channel: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
||||
{
|
||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||
if ($call_id != 0)
|
||||
{
|
||||
print T_("Ringing") . T_(" Extension ") . $regs[1] . " " . T_("Case id") . ": <a href=\"supervisor.php?case_id=$case_id\">$case_id</a>\n";
|
||||
@@ -557,8 +557,8 @@ class voipWatch extends voip {
|
||||
/**
|
||||
* The call has been answered
|
||||
*/
|
||||
else if (eregi("Event: Bridge.*Channel1: ((SIP/|IAX2/)[0-9]+)",$line,$regs))
|
||||
{
|
||||
else if (preg_match("{Event: Bridge.*Channel1: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
||||
{
|
||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||
if ($call_id != 0)
|
||||
{
|
||||
@@ -569,8 +569,8 @@ class voipWatch extends voip {
|
||||
/**
|
||||
* The call has been hung up
|
||||
*/
|
||||
else if (eregi("Event: Hangup.*Channel: ((SIP/|IAX2/)[0-9]+)",$line,$regs))
|
||||
{
|
||||
else if (preg_match("{Event: Hangup.*Channel: ((SIP/|IAX2/)[0-9]+)}is",$line,$regs))
|
||||
{
|
||||
list($call_id,$case_id) = $this->getCallId($regs[1]);
|
||||
if ($call_id != 0)
|
||||
{
|
||||
@@ -582,7 +582,7 @@ class voipWatch extends voip {
|
||||
/**
|
||||
* The status of an extension has changed to unregistered
|
||||
*/
|
||||
else if (eregi("Event: PeerStatus.*Peer: ((SIP/|IAX2/)[0-9]+).*PeerStatus: Unregistered",$line,$regs))
|
||||
else if (preg_match("{Event: PeerStatus.*Peer: ((SIP/|IAX2/)[0-9]+).*PeerStatus: Unregistered}is",$line,$regs))
|
||||
{
|
||||
print T_("Unregistered") . T_(" Extension ") . $regs[1] . "\n";
|
||||
$this->setExtensionStatus($regs[1],false);
|
||||
@@ -591,7 +591,7 @@ class voipWatch extends voip {
|
||||
/**
|
||||
* The status of an extension has changed to registered
|
||||
*/
|
||||
else if (eregi("Event: PeerStatus.*Peer: ((SIP/|IAX2/)[0-9]+).*PeerStatus: Registered",$line,$regs))
|
||||
else if (preg_match("{Event: PeerStatus.*Peer: ((SIP/|IAX2/)[0-9]+).*PeerStatus: Registered}is",$line,$regs))
|
||||
{
|
||||
print T_("Registered") . T_(" Extension ") . $regs[1] . "\n";
|
||||
$this->setExtensionStatus($regs[1],true);
|
||||
|
||||
@@ -191,7 +191,7 @@ if ($ca)
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_respondent_selection($operator_id))
|
||||
if (!is_respondent_selection($operator_id) && AUTO_DIAL_SECONDS == false)
|
||||
$data = get_limesurvey_url($operator_id);
|
||||
else
|
||||
$data = get_respondentselection_url($operator_id);
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
4854
locale/quexs.pot
4854
locale/quexs.pot
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
9
locale/updatepo.sh
Executable file
9
locale/updatepo.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
#Source: http://stackoverflow.com/questions/7496156/gettext-how-to-update-po-and-pot-files-after-the-source-is-modified
|
||||
echo '' > messages.po # xgettext needs that file, and we need it empty
|
||||
cd ..
|
||||
find . -type f -iname "*.php" | xgettext --keyword='T_' -o locale/messages.po -j -f -
|
||||
cd locale
|
||||
msgmerge -N quexs.pot messages.po > new.po
|
||||
mv new.po quexs.pot
|
||||
rm messages.po
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -141,6 +141,8 @@ else
|
||||
?> <p class='error'><?php echo T_("ERROR: No shifts at this time"); ?></p> <?php
|
||||
}
|
||||
|
||||
/* Disable as too time consuming
|
||||
|
||||
//call restrictions and outside times
|
||||
$sql = "SELECT count(*) as c
|
||||
FROM operator_questionnaire as oq
|
||||
@@ -169,7 +171,7 @@ else
|
||||
print "<p>" . T_("There are ") . $rs['c'] . T_(" unassigned case(s) available within the specified call restrictions") . "</p>";
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
|
||||
?>
|
||||
<p><?php echo T_("Limesurvey links:"); ?></p>
|
||||
|
||||
@@ -101,7 +101,7 @@ if (isset($_POST['submit']))
|
||||
|
||||
$rs = $db->GetAll($sql);
|
||||
|
||||
$tzone = DEFAULT_TIME_ZONE; //set this to default
|
||||
$tzone = get_setting("DEFAULT_TIME_ZONE"); //set this to default
|
||||
|
||||
//Get the timezone
|
||||
foreach($rs as $r)
|
||||
|
||||
Reference in New Issue
Block a user