From f9932d041cdcb3297f25187167cca4b0ceca9eae Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Fri, 14 Jun 2019 09:26:36 -0600 Subject: [PATCH] Update calls.php --- app/calls/calls.php | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/app/calls/calls.php b/app/calls/calls.php index a1e35f8dae..be929953fe 100644 --- a/app/calls/calls.php +++ b/app/calls/calls.php @@ -182,31 +182,21 @@ echo " ".(($row['forward_all_enabled'] == 'true') ? escape(format_phone($row['forward_all_destination'])) : ' ').""; } if (permission_exists('follow_me')) { - $follow_me_enabled = false; if (is_uuid($row['follow_me_uuid'])) { - //check if follow me is enabled - $sql = "select follow_me_enabled from v_follow_me "; + //get destination count if enabled + $follow_me_destination_count = 0; + if ($row['follow_me_enabled'] == 'true') { + $sql = "select count(follow_me_destination_uuid) as destination_count from v_follow_me_destinations "; $sql .= "where follow_me_uuid = :follow_me_uuid "; - $sql .= "and domain_uuid = :domain_uuid"; + $sql .= "and domain_uuid = :domain_uuid "; $parameters['follow_me_uuid'] = $row['follow_me_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database; - $follow_me_enabled = $database->select($sql, $parameters, 'column'); - - if ($follow_me_enabled == 'true') { $follow_me_enabled = true; } - //get destination count if enabled - if ($follow_me_enabled) { - $sql = "select count(follow_me_destination_uuid) as destination_count from v_follow_me_destinations "; - $sql .= "where follow_me_uuid = :follow_me_uuid "; - $sql .= "and domain_uuid = :domain_uuid "; - $parameters['follow_me_uuid'] = $row['follow_me_uuid']; - $parameters['domain_uuid'] = $_SESSION['domain_uuid']; - $database = new database; - $follow_me_destination_count = $database->select($sql, $parameters, 'column'); - } + $follow_me_destination_count = $database->select($sql, $parameters, 'column'); + } } echo " \n"; - if ($follow_me_enabled && $follow_me_destination_count > 0) { + if ($row['follow_me_enabled'] == 'true' && $follow_me_destination_count > 0) { echo ' '.$text['label-enabled']." (".$follow_me_destination_count.")\n"; } else {