diff --git a/app/call_centers/call_center_agent_edit.php b/app/call_centers/call_center_agent_edit.php
index 967685eba9..9c057d4c8e 100644
--- a/app/call_centers/call_center_agent_edit.php
+++ b/app/call_centers/call_center_agent_edit.php
@@ -47,14 +47,14 @@
$text = $language->get();
//check for duplicates
- if ($_GET["check"] == 'duplicate') {
+ if (!empty($_GET["check"]) == 'duplicate') {
//agent id
- if ($_GET["agent_id"] != '') {
+ if (!empty($_GET["agent_id"])) {
$sql = "select agent_name ";
$sql .= "from v_call_center_agents ";
$sql .= "where agent_id = :agent_id ";
$sql .= "and domain_uuid = :domain_uuid ";
- if (is_uuid($_GET["agent_uuid"])) {
+ if (!empty($_GET["agent_uuid"]) && is_uuid($_GET["agent_uuid"])) {
$sql .= " and call_center_agent_uuid <> :call_center_agent_uuid ";
$parameters['call_center_agent_uuid'] = $_GET["agent_uuid"];
}
@@ -62,7 +62,7 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$row = $database->select($sql, $parameters, 'row');
- if (is_array($row) && sizeof($row) != 0 && $row['agent_name'] != '') {
+ if (!empty($row) && !empty($row['agent_name'])) {
echo $text['message-duplicate_agent_id'].(if_group("superadmin") ? ": ".$row["agent_name"] : null);
}
unset($sql, $parameters);
@@ -72,7 +72,7 @@
}
//action add or update
- if (is_uuid($_REQUEST["id"])) {
+ if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$action = "update";
$call_center_agent_uuid = $_REQUEST["id"];
}
@@ -81,7 +81,7 @@
}
//get http post variables and set them to php variables
- if (is_array($_POST)) {
+ if (!empty($_POST)) {
$call_center_agent_uuid = $_POST["call_center_agent_uuid"];
$user_uuid = $_POST["user_uuid"];
$agent_name = $_POST["agent_name"];
@@ -101,7 +101,7 @@
}
//process the user data and save it to the database
- if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
+ if (!empty($_POST) && empty($_POST["persistformvar"])) {
//validate the token
$token = new token;
@@ -287,7 +287,7 @@
$destination = new destinations;
//pre-populate the form
- if (is_uuid($_GET["id"]) && $_POST["persistformvar"] != "true") {
+ if (!empty($_GET["id"]) && is_uuid($_GET["id"]) && empty($_POST["persistformvar"])) {
$call_center_agent_uuid = $_GET["id"];
$sql = "select * from v_call_center_agents ";
$sql .= "where domain_uuid = :domain_uuid ";
@@ -296,7 +296,7 @@
$parameters['call_center_agent_uuid'] = $call_center_agent_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
- if (is_array($row) && @sizeof($row) != 0) {
+ if (!empty($row)) {
$call_center_agent_uuid = $row["call_center_agent_uuid"];
$user_uuid = $row["user_uuid"];
$agent_name = $row["agent_name"];
@@ -401,7 +401,7 @@
echo " ".$text['label-agent_name']."\n";
echo "\n";
echo "
\n";
- echo " \n";
+ echo " \n";
/*
echo "";
unset($users);
echo " \n";
- echo " ".$text['description-users']."\n";
+ echo " ".!empty($text['description-users'])."\n";
echo " | ";
echo " ";
@@ -469,7 +469,7 @@
echo " ".$text['label-agent_id']."\n";
echo "\n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo " \n";
echo $text['description-agent_id']."\n";
@@ -481,7 +481,7 @@
echo " ".$text['label-agent_password']."\n";
echo " | \n";
echo "\n";
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-agent_password']."\n";
echo " | \n";
@@ -492,7 +492,7 @@
echo " ".$text['label-contact']."\n";
echo "\n";
echo "\n";
- echo $destination->select('user_contact', 'agent_contact', $agent_contact);
+ echo $destination->select('user_contact', 'agent_contact', !empty($agent_contact));
echo " \n";
echo $text['description-contact']."\n";
echo " | \n";
diff --git a/app/call_centers/call_center_agents.php b/app/call_centers/call_center_agents.php
index 26e19865ca..eec639110c 100644
--- a/app/call_centers/call_center_agents.php
+++ b/app/call_centers/call_center_agents.php
@@ -46,15 +46,18 @@
$language = new text;
$text = $language->get();
+//set from session variables
+ $list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
+
//get posted data
- if (is_array($_POST['call_center_agents'])) {
+ if (!empty($_POST['call_center_agents'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$call_center_agents = $_POST['call_center_agents'];
}
//process the http post data by action
- if ($action != '' && is_array($call_center_agents) && @sizeof($call_center_agents) != 0) {
+ if (!empty($action) && !empty($call_center_agents)) {
switch ($action) {
case 'delete':
if (permission_exists('call_center_agent_delete')) {
@@ -69,11 +72,11 @@
}
//get http variables and set them to php variables
- $order_by = $_GET["order_by"];
- $order = $_GET["order"];
+ $order_by = $_GET["order_by"] ?? '';
+ $order = $_GET["order"] ?? '';
//add the search term
- $search = strtolower($_GET["search"]);
+ $search = strtolower($_GET["search"] ?? '');
if (!empty($search)) {
$sql_search = " (";
$sql_search .= "lower(agent_name) like :search ";
@@ -85,23 +88,23 @@
//get total call center agent count from the database
$sql = "select count(*) from v_call_center_agents ";
$sql .= "where true ";
- if ($_GET['show'] != "all" || !permission_exists('call_center_all')) {
+ if (!empty($_GET['show']) != "all" || !permission_exists('call_center_all')) {
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
}
- if (isset($sql_search)) {
+ if (!empty($sql_search)) {
$sql .= "and ".$sql_search;
}
$database = new database;
- $num_rows = $database->select($sql, $parameters, 'column');
+ $num_rows = $database->select($sql, $parameters ?? null, 'column');
//prepare to page the results
- $rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+ $rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = "&search=".urlencode($search);
- if ($_GET['show'] == "all" && permission_exists('call_center_all')) {
+ if (!empty($_GET['show']) == "all" && permission_exists('call_center_all')) {
$param .= "&show=all";
}
- $page = $_GET['page'];
+ $page = $_GET['page'] ?? '';
if (empty($page)) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
@@ -112,7 +115,7 @@
$sql .= order_by($order_by, $order, 'agent_name', 'asc');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
- $result = $database->select($sql, $parameters, 'all');
+ $result = $database->select($sql, $parameters ?? null, 'all');
unset($sql, $parameters);
//create token
@@ -142,7 +145,7 @@
}
echo "