Only show the contact details if they are in the view.

This commit is contained in:
FusionPBX
2021-10-06 11:04:49 -06:00
committed by GitHub
parent bbd8bc8d55
commit e701c9c261

View File

@@ -50,6 +50,21 @@
$users = $_POST['users'];
}
//check to see if contact details are in the view
$sql = "select * from view_users ";
$sql .= "where domain_uuid = :domain_uuid ";
$parameters = null;
$database = new database;
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$row = $database->select($sql, $parameters, 'row');
if (isset($row['contact_organization'])) {
$show_contact_fields = true;
}
else {
$show_contact_fields = false;
}
unset($parameters);
//process the http post data by action
if ($action != '' && is_array($users) && @sizeof($users) != 0) {
switch ($action) {
@@ -130,7 +145,10 @@
//get the list
$sql = "select domain_name, domain_uuid, user_uuid, username, group_names, ";
$sql .= "contact_organization,contact_name, cast(user_enabled as text) ";
if ($show_contact_fields) {
$sql .= "contact_organization,contact_name, ";
}
$sql .= "cast(user_enabled as text) ";
$sql .= "from view_users ";
if ($_GET['show'] == "all" && permission_exists('user_all')) {
if (isset($sql_search)) {
@@ -234,8 +252,10 @@
}
echo th_order_by('username', $text['label-username'], $order_by, $order, null, null, $param);
echo th_order_by('group_names', $text['label-groups'], $order_by, $order, null, null, $param);
echo th_order_by('contact_organization', $text['label-organization'], $order_by, $order, null, null, $param);
echo th_order_by('contact_name', $text['label-name'], $order_by, $order, null, null, $param);
if ($show_contact_fields) {
echo th_order_by('contact_organization', $text['label-organization'], $order_by, $order, null, null, $param);
echo th_order_by('contact_name', $text['label-name'], $order_by, $order, null, null, $param);
}
//echo th_order_by('contact_name_family', $text['label-contact_name_family'], $order_by, $order);
//echo th_order_by('user_status', $text['label-user_status'], $order_by, $order);
//echo th_order_by('add_date', $text['label-add_date'], $order_by, $order);
@@ -270,8 +290,10 @@
}
echo " </td>\n";
echo " <td>".escape($row['group_names'])."</td>\n";
echo " <td>".escape($row['contact_organization'])."</td>\n";
echo " <td>".escape($row['contact_name'])."</td>\n";
if ($show_contact_fields) {
echo " <td>".escape($row['contact_organization'])."</td>\n";
echo " <td>".escape($row['contact_name'])."</td>\n";
}
//echo " <td>".escape($row['contact_name_given'])."</td>\n";
//echo " <td>".escape($row['contact_name_family'])."</td>\n";
//echo " <td>".escape($row['user_status'])."</td>\n";