diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php
index 13942dabdb..852cc1de4a 100644
--- a/app/voicemails/voicemail_messages.php
+++ b/app/voicemails/voicemail_messages.php
@@ -86,7 +86,7 @@ if (!(check_str($_REQUEST["action"]) == "download" && check_str($_REQUEST["src"]
require_once "resources/paging.php";
//show the content
- echo "".$text['title-voicemail_messages']."";
+ echo "".$text['title-voicemail_messages']." (".count($voicemails).")";
echo "
";
echo $text['description-voicemail_message'];
echo "
";
@@ -185,17 +185,13 @@ if (!(check_str($_REQUEST["action"]) == "download" && check_str($_REQUEST["src"]
$previous_voicemail_id = $field['voicemail_id'];
unset($sql, $result, $result_count);
-
}
-
echo "";
echo "
";
-
}
else {
echo "
".$text['message-messages_not_found']."
";
}
-
echo "
";
//autoplay message
diff --git a/app/voicemails/voicemails.php b/app/voicemails/voicemails.php
index c4cb62fc62..4224259456 100644
--- a/app/voicemails/voicemails.php
+++ b/app/voicemails/voicemails.php
@@ -57,11 +57,73 @@ else {
require_once "resources/header.php";
require_once "resources/paging.php";
+//prepare to page the results
+ $sql = "select count(*) as num_rows from v_voicemails ";
+ $sql .= "where domain_uuid = '$domain_uuid' ";
+ if (strlen($search) > 0) {
+ $sql .= "and (";
+ $sql .= " voicemail_id like '%".$search."%' ";
+ $sql .= " or voicemail_mail_to like '%".$search."%' ";
+ $sql .= " or voicemail_local_after_email like '%".$search."%' ";
+ $sql .= " or voicemail_enabled like '%".$search."%' ";
+ $sql .= " or voicemail_description like '%".$search."%' ";
+ $sql .= ") ";
+ }
+ if (!permission_exists('voicemail_delete')) {
+ $x = 0;
+ if (count($voicemail_uuids) > 0) {
+ $sql .= "and (";
+ foreach($voicemail_uuids as $row) {
+ if ($x == 0) {
+ $sql .= "voicemail_uuid = '".$row['voicemail_uuid']."' ";
+ }
+ else {
+ $sql .= " or voicemail_uuid = '".$row['voicemail_uuid']."'";
+ }
+ $x++;
+ }
+ $sql .= ")";
+ }
+ else {
+ $sql .= "and voicemail_uuid is null ";
+ }
+ }
+ $prep_statement = $db->prepare($sql);
+ if ($prep_statement) {
+ $prep_statement->execute();
+ $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
+ if ($row['num_rows'] > 0) {
+ $num_rows = $row['num_rows'];
+ }
+ else {
+ $num_rows = '0';
+ }
+ }
+
+//prepare to page the results
+ $rows_per_page = 150;
+ $param = "";
+ if ($search != '') { $param .= "&search=".$search; }
+ if ($order_by != '') { $param .= "&order_by=".$order_by."&order=".$order; }
+ $page = $_GET['page'];
+ if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
+ list($paging_controls, $rows_per_page, $var3) = paging($num_rows, $param, $rows_per_page);
+ $offset = $rows_per_page * $page;
+
+//get the list
+ $sql = str_replace('count(*) as num_rows', '*', $sql);
+ $sql .= ($order_by != '') ? "order by ".$order_by." ".$order." " : "order by voicemail_id asc ";
+ $sql .= "limit ".$rows_per_page." offset ".$offset." ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $voicemails = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+ unset ($prep_statement, $sql);
+
//show the content
echo "
| ";
- echo " ".$text['title-voicemails']."";
+ echo " ".$text['title-voicemails']." (".$num_rows.")";
echo " "; echo " ".$text['description-voicemail']; echo " "; @@ -75,74 +137,11 @@ else { echo " |
| "; @@ -202,7 +201,7 @@ else { echo " | ||||||||||
| \n"; | ||||||||||