Update voicemail_edit.php

This commit is contained in:
FusionPBX 2019-10-10 09:25:53 -06:00 committed by GitHub
parent fb66b0a9f9
commit 3b55af069f
1 changed files with 200 additions and 200 deletions

View File

@ -99,7 +99,7 @@
}
//assign the voicemail id copy to the voicemail id
if (is_uuid($voicemail_uuid) && is_uuid($_REQUEST["voicemail_uuid_copy"])) {
if (permission_exists('voicemail_forward_destinations') && is_uuid($voicemail_uuid) && is_uuid($_REQUEST["voicemail_uuid_copy"])) {
//set the variables
$voicemail_uuid_copy = $_REQUEST["voicemail_uuid_copy"];
//build insert array
@ -122,7 +122,8 @@
message::add($text['message-add']);
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//process the data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
@ -153,24 +154,15 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//get a new voicemail_uuid
if ($action == "add" && permission_exists('voicemail_add')) {
//begin insert array
$voicemail_uuid = uuid();
$array['voicemails'][0]['voicemail_uuid'] = $voicemail_uuid;
//set message
message::add($text['message-add']);
}
if ($action == "update" && permission_exists('voicemail_edit')) {
//begin update array
$array['voicemails'][0]['voicemail_uuid'] = $voicemail_uuid;
//set message
message::add($text['message-update']);
}
if (is_array($array) && @sizeof($array) != 0) {
//add common array fields
$array['voicemails'][0]['domain_uuid'] = $domain_uuid;
$array['voicemails'][0]['voicemail_uuid'] = $voicemail_uuid;
$array['voicemails'][0]['voicemail_id'] = $voicemail_id;
$array['voicemails'][0]['voicemail_password'] = $voicemail_password;
$array['voicemails'][0]['greeting_id'] = $greeting_id != '' ? $greeting_id : null;
@ -185,17 +177,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
$array['voicemails'][0]['voicemail_enabled'] = $voicemail_enabled;
$array['voicemails'][0]['voicemail_description'] = $voicemail_description;
//execute insert/update
$database = new database;
$database->app_name = 'voicemails';
$database->app_uuid = 'b523c2d2-64cd-46f1-9520-ca4b4098e044';
$database->save($array);
unset($array);
}
// add voicemail options
if (sizeof($voicemail_options) > 0) {
//add voicemail options
if (permission_exists('voicemail_options') && sizeof($voicemail_options) > 0) {
foreach ($voicemail_options as $index => $voicemail_option) {
if ($voicemail_option['voicemail_option_digits'] == '' || $voicemail_option['voicemail_option_param'] == '') { unset($voicemail_options[$index]); }
}
@ -238,6 +227,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
}
//set message
if ($action == "add" && permission_exists('voicemail_add')) {
message::add($text['message-add']);
}
if ($action == "update" && permission_exists('voicemail_edit')) {
message::add($text['message-update']);
}
//redirect user
if ($action == 'add') {
header("Location: voicemails.php");
@ -246,9 +243,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
header("Location: voicemail_edit.php?id=".$voicemail_uuid);
}
exit;
}
}
}
//initialize the destinations object
$destination = new destinations;
@ -431,6 +427,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('voicemail_options')) {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-options']."</td>";
echo " <td class='vtable' align='left'>";
@ -531,6 +528,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <br />\n";
echo " </td>";
echo " </tr>";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
@ -542,7 +540,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['description-voicemail_mail_to']."\n";
echo "</td>\n";
echo "</tr>\n";
if(permission_exists('sms_edit')) {
if (permission_exists('sms_edit')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_sms_to']."\n";
@ -554,7 +553,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
}
if(permission_exists('voicemail_transcription_edit') && $_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") {
if (permission_exists('voicemail_transcription_edit') && $_SESSION['voicemail']['transcribe_enabled']['boolean'] == "true") {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-voicemail_transcription_enabled']."\n";
@ -601,7 +601,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
}
if ($action == "update") {
if (permission_exists('voicemail_forward_destinations') && $action == "update") {
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-forward_destinations']."</td>";
echo " <td class='vtable'>";
@ -631,7 +631,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>\n";
echo " <td class='vtable'>".escape($field['voicemail_id'])."</td>\n";
echo " <td>\n";
echo " <a href='voicemail_edit.php?id=".escape($voicemail_uuid)."&voicemail_destination_uuid=".escape($field['voicemail_destination_uuid'])."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
echo " <a href='voicemail_edit.php?id=".urlencode($voicemail_uuid)."&voicemail_destination_uuid=".urlencode($field['voicemail_destination_uuid'])."&a=delete' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">".$v_link_label_delete."</a>\n";
echo " </td>\n";
echo " </tr>\n";
$voicemail_uuids_copied[] = $field['voicemail_uuid_copy'];