Fix a voicemail greeting delete problem as described here.

http://code.google.com/p/fusionpbx/issues/detail?id=404
This commit is contained in:
Mark Crane 2013-04-15 15:49:42 +00:00
parent 70af1d955b
commit 2d9cb53435
4 changed files with 37 additions and 41 deletions

View File

@ -1,6 +1,6 @@
<?php
//v_voicemail_greetings
//voicemail_greetings
$text['title']['en-us'] = 'Voicemail Greetings';
$text['title']['pt-pt'] = 'Saudações de correio de voz';
@ -31,11 +31,11 @@
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = 'Guardar';
//v_voicemail_greetings_delete
$text['confirm-delete-2']['en-us'] = 'Delete Complete';
$text['confirm-delete-2']['pt-pt'] = 'Eliminação Completa';
//voicemail_greeting_delete
$text['confirm-delete']['en-us'] = 'Delete Complete';
$text['confirm-delete']['pt-pt'] = 'Eliminação Completa';
//v_voicemail_greetings_edit
//voicemail_greeting_edit
$text['confirm-name']['en-us'] = 'Please provide: Greeting Name (play)';
$text['confirm-name']['pt-pt'] = 'Por favor, forneça: Nome da saudação (execução)';

View File

@ -26,7 +26,6 @@
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
require_once "app_languages.php";
if (permission_exists('voicemail_greetings_delete')) {
//access granted
}
@ -36,7 +35,8 @@ else {
}
//add multi-lingual support
foreach($content_voicemail_greetings as $key => $value) {
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
@ -48,7 +48,7 @@ if (count($_GET)>0) {
if (strlen($id)>0) {
//get the greeting filename
$sql = "select * from v_voicemail_greetings ";
$sql .= "where greeting_uuid = '$id' ";
$sql .= "where voicemail_greeting_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_id = '$voicemail_id' ";
$prep_statement = $db->prepare(check_sql($sql));
@ -62,7 +62,7 @@ if (strlen($id)>0) {
//delete recording from the database
$sql = "delete from v_voicemail_greetings ";
$sql .= "where greeting_uuid = '$id' ";
$sql .= "where voicemail_greeting_uuid = '$id' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= "and voicemail_id = '$voicemail_id' ";
$prep_statement = $db->prepare(check_sql($sql));
@ -80,7 +80,7 @@ if (strlen($id)>0) {
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_greetings.php?id=$voicemail_id\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-delete-2']."\n";
echo "".$text['confirm-delete']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;

View File

@ -43,7 +43,7 @@ else {
//set the action as an add or an update
if (isset($_REQUEST["id"])) {
$action = "update";
$greeting_uuid = check_str($_REQUEST["id"]);
$voicemail_greeting_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
@ -51,7 +51,7 @@ else {
//get the form value and set to php variables
$voicemail_id = check_str($_REQUEST["voicemail_id"]);
if (count($_POST)>0) {
if (count($_POST) > 0) {
$greeting_name = check_str($_POST["greeting_name"]);
$greeting_description = check_str($_POST["greeting_description"]);
@ -64,7 +64,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$greeting_uuid = check_str($_POST["greeting_uuid"]);
$voicemail_greeting_uuid = check_str($_POST["voicemail_greeting_uuid"]);
}
//check for all required data
@ -117,8 +117,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update" && permission_exists('voicemail_greetings_edit')) {
//get the original filename
$sql = "select * from v_voicemail_greetings ";
$sql .= "where greeting_uuid = '$greeting_uuid' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$sql .= "where voicemail_greeting_uuid = '$voicemail_greeting_uuid' ";
$sql .= "and voicemail_greeting_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@ -140,27 +140,28 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "greeting_name = '$greeting_name', ";
$sql .= "greeting_description = '$greeting_description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and greeting_uuid = '$greeting_uuid' ";
$sql .= "and voicemail_greeting_uuid = '$voicemail_greeting_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_greetings.php?id=".$voicemail_id."\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_greetings.php?id=".$voicemail_id."\">\n";
echo "<div align='center'>\n";
echo "".$text['confirm-update']."\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$greeting_uuid = $_GET["id"];
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$voicemail_greeting_uuid = check_str($_GET["id"]);
$sql = "select * from v_voicemail_greetings ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and greeting_uuid = '$greeting_uuid' ";
$sql .= "and voicemail_greeting_uuid = '$voicemail_greeting_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@ -183,7 +184,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
@ -192,7 +192,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<td align='left' width='30%' nowrap><b>".$text['label-add']."</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap><b>".$text['label-edit']['en-us']."</b></td>\n";
echo "<td align='left' width='30%' nowrap><b>".$text['label-edit']."</b></td>\n";
}
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='voicemail_greetings.php?id=".$voicemail_id."'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
@ -221,7 +221,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='greeting_uuid' value='$greeting_uuid'>\n";
echo " <input type='hidden' name='voicemail_greeting_uuid' value='$voicemail_greeting_uuid'>\n";
}
echo " <input type='hidden' name='voicemail_id' value='$voicemail_id'>\n";
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";

View File

@ -48,8 +48,8 @@ else {
//get the http get values and set them as php variables
$voicemail_id = check_str($_REQUEST["id"]);
$order_by = $_GET["order_by"];
$order = $_GET["order"];
$order_by = check_str($_GET["order_by"]);
$order = check_str($_GET["order"]);
//used to search the array to determin if an extension is assigned to the user
function is_extension_assigned($number) {
@ -301,7 +301,7 @@ else {
echo "<th align='right'>".$text['table-download']."</th>\n";
echo "<th width=\"50px\" class=\"listhdr\" nowrap=\"nowrap\">".$text['table-size']."</th>\n";
echo th_order_by('greeting_description', $text['table-description'], $order_by, $order);
echo "<td align='right' width='42'>\n";
echo "<td align='right' width='21'>\n";
//if (permission_exists('voicemail_greetings_add')) {
// echo " <a href='voicemail_greetings_edit.php?&voicemail_id=".$voicemail_id."' alt='add'>$v_link_label_add</a>\n";
//}
@ -343,11 +343,11 @@ else {
echo " <td valign='top' class='row_stylebg'>".$row['greeting_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('voicemail_greetings_edit')) {
echo " <a href='voicemail_greetings_edit.php?id=".$row['greeting_uuid']."&voicemail_id=".$voicemail_id."' alt='edit'>$v_link_label_edit</a>\n";
}
//if (permission_exists('voicemail_greetings_edit')) {
// echo " <a href='voicemail_greeting_edit.php?id=".$row['voicemail_greeting_uuid']."&voicemail_id=".$voicemail_id."' alt='edit'>$v_link_label_edit</a>\n";
//}
if (permission_exists('voicemail_greetings_delete')) {
echo " <a href='voicemail_greetings_delete.php?id=".$row['greeting_uuid']."&voicemail_id=".$voicemail_id."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
echo " <a href='voicemail_greeting_delete.php?id=".$row['voicemail_greeting_uuid']."&voicemail_id=".$voicemail_id."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
@ -362,11 +362,7 @@ else {
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
//if (permission_exists('voicemail_greetings_add')) {
// echo " <a href='voicemail_greetings_edit.php?voicemail_id=".$voicemail_id."' alt='add'>$v_link_label_add</a>\n";
//}
echo " </td>\n";
echo " <td width='33.3%' align='right'>&nbsp;</td>\n";
echo " </tr>\n";
echo " </table>\n";