Call Centers: Updates for PHP 8.1

This commit is contained in:
fusionate 2023-06-01 23:59:29 +00:00
parent be9390795c
commit 0849bf51a0
No known key found for this signature in database
5 changed files with 41 additions and 66 deletions

View File

@ -47,7 +47,7 @@
//get the queue_name and set it as a variable
$queue_name = $_GET['queue_name'];
$name = $_GET['name'];
$name = $_GET['name'] ?? null;
//get a new session array
unset($_SESSION['queues']);

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2020
Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -87,7 +87,7 @@
//get http post variables and set them to php variables
if (!empty($_POST)) {
$call_center_agent_uuid = $_POST["call_center_agent_uuid"];
$call_center_agent_uuid = $_POST["call_center_agent_uuid"] ?? null;
$user_uuid = $_POST["user_uuid"];
$agent_name = $_POST["agent_name"];
$agent_type = $_POST["agent_type"];
@ -360,7 +360,7 @@
function check_duplicates() {
//check agent id
var agent_id = document.getElementById('agent_id').value;
$("#duplicate_agent_id_response").load("call_center_agent_edit.php?check=duplicate&agent_id="+agent_id+"&agent_uuid=<?php echo escape($call_center_agent_uuid); ?>", function() {
$("#duplicate_agent_id_response").load("call_center_agent_edit.php?check=duplicate&agent_id="+agent_id+"&agent_uuid=<?php echo escape($call_center_agent_uuid ?? ''); ?>", function() {
var duplicate_agent_id = false;
if ($("#duplicate_agent_id_response").html() != '') {
$('#agent_id').addClass('formfld_highlight_bad');
@ -454,13 +454,8 @@
echo " <td class='vtable' align='left'>";
echo " <select name=\"user_uuid\" class='formfld' style='width: auto;'>\n";
echo " <option value=\"\"></option>\n";
foreach($users as $field) {
if ($user_uuid == $field['user_uuid']) {
echo " <option value='".escape($field['user_uuid'])."' selected='selected'>".escape($field['username'])."</option>\n";
}
else {
echo " <option value='".escape($field['user_uuid'])."' $selected>".escape($field['username'])."</option>\n";
}
foreach ($users as $field) {
echo " <option value='".escape($field['user_uuid'])."' ".(!empty($user_uuid) && $user_uuid == $field['user_uuid'] ? "selected='selected'" : null).">".escape($field['username'])."</option>\n";
}
echo " </select>";
unset($users);
@ -509,31 +504,11 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='agent_status'>\n";
echo " <option value=''></option>\n";
if ($agent_status == "Logged Out") {
echo " <option value='Logged Out' SELECTED >".$text['option-logged_out']."</option>\n";
}
else {
echo " <option value='Logged Out'>".$text['option-logged_out']."</option>\n";
}
if ($agent_status == "Available") {
echo " <option value='Available' SELECTED >".$text['option-available']."</option>\n";
}
else {
echo " <option value='Available'>".$text['option-available']."</option>\n";
}
if ($agent_status == "Available (On Demand)") {
echo " <option value='Available (On Demand)' SELECTED >".$text['option-available_on_demand']."</option>\n";
}
else {
echo " <option value='Available (On Demand)'>".$text['option-available_on_demand']."</option>\n";
}
if ($agent_status == "On Break") {
echo " <option value='On Break' SELECTED >".$text['option-on_break']."</option>\n";
}
else {
echo " <option value='On Break'>".$text['option-on_break']."</option>\n";
}
echo " <option value=''></option>\n";
echo " <option value='Logged Out' ".(!empty($agent_status) && $agent_status == "Logged Out" ? "selected='selected'" : null).">".$text['option-logged_out']."</option>\n";
echo " <option value='Available' ".(!empty($agent_status) && $agent_status == "Available" ? "selected='selected'" : null).">".$text['option-available']."</option>\n";
echo " <option value='Available (On Demand)' ".(!empty($agent_status) && $agent_status == "Available (On Demand)" ? "selected='selected'" : null).">".$text['option-available_on_demand']."</option>\n";
echo " <option value='On Break' ".(!empty($agent_status) && $agent_status == "On Break" ? "selected='selected'" : null).">".$text['option-on_break']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-status']."\n";
@ -601,8 +576,8 @@
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='agent_record'>\n";
echo " <option value='true' ".($agent_record == "true" ? "selected='selected'" : '')." >".$text['option-true']."</option>\n";
echo " <option value='false' ".($agent_record != "true" ? "selected='selected'" : '').">".$text['option-false']."</option>\n";
echo " <option value='true'>".$text['option-true']."</option>\n";
echo " <option value='false' ".(!empty($agent_record) && $agent_record != "true" ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
echo "<br />\n";
echo $text['description-record_template']."\n";
@ -635,4 +610,4 @@
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2022
Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -89,7 +89,7 @@
if (!empty($_POST)) {
//get the post variables a run a security chack on them
//$domain_uuid = $_POST["domain_uuid"];
$dialplan_uuid = $_POST["dialplan_uuid"];
$dialplan_uuid = $_POST["dialplan_uuid"] ?? null;
$queue_name = $_POST["queue_name"];
$queue_extension = $_POST["queue_extension"];
$queue_greeting = $_POST["queue_greeting"];
@ -110,13 +110,13 @@
$queue_discard_abandoned_after = $_POST["queue_discard_abandoned_after"];
$queue_abandoned_resume_allowed = $_POST["queue_abandoned_resume_allowed"];
$queue_cid_prefix = $_POST["queue_cid_prefix"];
$queue_outbound_caller_id_name = $_POST["queue_outbound_caller_id_name"];
$queue_outbound_caller_id_number = $_POST["queue_outbound_caller_id_number"];
$queue_announce_position = $_POST["queue_announce_position"];
$queue_outbound_caller_id_name = $_POST["queue_outbound_caller_id_name"] ?? null;
$queue_outbound_caller_id_number = $_POST["queue_outbound_caller_id_number"] ?? null;
$queue_announce_position = $_POST["queue_announce_position"] ?? null;
$queue_announce_sound = $_POST["queue_announce_sound"];
$queue_announce_frequency = $_POST["queue_announce_frequency"];
$queue_cc_exit_keys = $_POST["queue_cc_exit_keys"];
$queue_email_address = $_POST["queue_email_address"];
$queue_email_address = $_POST["queue_email_address"] ?? null;
$queue_description = $_POST["queue_description"];
//remove invalid characters
@ -362,7 +362,7 @@
if ($queue_time_base_score_sec != '') {
$dialplan_xml .= " <action application=\"set\" data=\"cc_base_score=".xml::sanitize($queue_time_base_score_sec)."\"/>\n";
}
if ($queue_greeting_path != '') {
if (!empty($queue_greeting_path)) {
$dialplan_xml .= " <action application=\"sleep\" data=\"1000\"/>\n";
$greeting_array = explode(':', $queue_greeting_path);
if (count($greeting_array) == 1) {
@ -446,9 +446,9 @@
remove_config_from_cache('configuration:callcenter.conf');
//add agent/tier to queue
$agent_name = $_POST["agent_name"];
$tier_level = $_POST["tier_level"];
$tier_position = $_POST["tier_position"];
$agent_name = $_POST["agent_name"] ?? null;
$tier_level = $_POST["tier_level"] ?? null;
$tier_position = $_POST["tier_position"] ?? null;
if (!empty($agent_name)) {
//setup the event socket connection
@ -735,7 +735,7 @@
echo "<optgroup label=".$text['label-'.$key].">\n";
$selected = false;
foreach($value as $row) {
if ($queue_greeting == $row["value"]) {
if (!empty($queue_greeting) && $queue_greeting == $row["value"]) {
$selected = true;
echo " <option value='".escape($row["value"])."' selected='selected'>".escape($row["name"])."</option>\n";
}
@ -890,7 +890,7 @@
}
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-music_on_hold']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
@ -1248,11 +1248,11 @@
foreach ($recordings as &$row) {
$recording_name = $row["recording_name"];
$recording_filename = $row["recording_filename"];
if ($queue_announce_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename && !empty($queue_announce_sound)) {
if (!empty($queue_announce_sound) && $queue_announce_sound == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$recording_filename) {
$tmp_selected = true;
echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
}
else if ($queue_announce_sound == $recording_filename && !empty($queue_announce_sound)) {
else if (!empty($queue_announce_sound) && $queue_announce_sound == $recording_filename) {
$tmp_selected = true;
echo " <option value='".escape($_SESSION['switch']['recordings']['dir'])."/".escape($_SESSION['domain_name'])."/".escape($recording_filename)."' selected='selected'>".escape($recording_name)."</option>\n";
}

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -45,7 +45,7 @@
$cmd = $_GET['cmd'];
//pre-populate the form
if (is_array($_GET) && is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") {
if (!empty($_GET) && is_array($_GET) && is_uuid($_GET["id"]) && (empty($_POST["persistformvar"]) || $_POST["persistformvar"] != "true")) {
$call_center_queue_uuid = $_GET["id"];
$sql = "select queue_extension from v_call_center_queues ";
$sql .= "where domain_uuid = :domain_uuid ";
@ -89,4 +89,4 @@
$_SESSION["message"] = $response;
header("Location: call_center_queues.php?savemsg=".urlencode($response));
?>
?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Copyright (C) 2015 - 2021
Copyright (C) 2015 - 2023
All Rights Reserved.
Contributor(s):
@ -294,8 +294,8 @@
//filter out unchecked, build where clause for below
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = $record['uuid'];
}
}
@ -303,7 +303,7 @@
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->uuid_prefix."uuid as uuid, dialplan_uuid, queue_name, queue_extension from v_".$this->table." ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$sql .= "and ".$this->uuid_prefix."uuid in ('".implode("','", $uuids)."') ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
@ -343,7 +343,7 @@
//delete the queue in the switch
if ($fp) {
foreach ($uuids as $uuid) {
$cmd = "api callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$_SESSION["domin_name"];
$cmd = "api callcenter_config queue unload ".$call_center_queues[$uuid]['queue_extension']."@".$_SESSION["domain_name"];
$response = event_socket_request($fp, $cmd);
}
}
@ -417,7 +417,7 @@
//filter out unchecked
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = $record['uuid'];
}
}
@ -503,8 +503,8 @@
//get checked records
foreach ($records as $x => $record) {
if ($record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = "'".$record['uuid']."'";
if (!empty($record['checked']) && $record['checked'] == 'true' && is_uuid($record['uuid'])) {
$uuids[] = $record['uuid'];
}
}
@ -513,7 +513,7 @@
//primary table
$sql = "select * from v_".$this->table." ";
$sql .= "where ".$this->uuid_prefix."uuid in (".implode(', ', $uuids).") ";
$sql .= "where ".$this->uuid_prefix."uuid in ('".implode("','", $uuids)."') ";
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
@ -627,4 +627,4 @@ $c->queue_cc_exit_keys = "";
$c->dialplan();
*/
?>
?>