diff --git a/app/voicemails/app_languages.php b/app/voicemails/app_languages.php index 90e62fba5c..0bef9c1728 100644 --- a/app/voicemails/app_languages.php +++ b/app/voicemails/app_languages.php @@ -76,6 +76,16 @@ $text['description-voicemail_local_after_email']['pt-pt'] = "Escolha se pretende manter o ficheiro de correio de voz depois de enviar email."; $text['description-voicemail_local_after_email']['fr-fr'] = "Garder le message vocal dans la boite vocale après l'envoi du courriel."; + $text['label-copy_destinations']['en-us'] = "Copy Destinations"; + $text['label-copy_destinations']['es-cl'] = "Copiar Destinos"; + $text['label-copy_destinations']['pt-pt'] = "Copiar Destinos"; + $text['label-copy_destinations']['fr-fr'] = "Copier Destinations"; + + $text['description-copy_destinations']['en-us'] = "Set other Voicemail IDs to also receive a copy of incoming voice messages."; + $text['description-copy_destinations']['es-cl'] = "Establezca otras identificaciones de correo de voz para recibir también una copia de los mensajes de voz entrantes."; + $text['description-copy_destinations']['pt-pt'] = "Defina outras identificações Voicemail também para receber uma cópia das mensagens de voz recebidas."; + $text['description-copy_destinations']['fr-fr'] = "Définissez les autres identifications de messagerie vocale de recevoir également une copie des messages vocaux entrants."; + $text['label-voicemail_enabled']['en-us'] = "Enabled"; $text['label-voicemail_enabled']['es-cl'] = "Activado"; $text['label-voicemail_enabled']['pt-pt'] = "Habilitado"; @@ -243,7 +253,7 @@ $text['label-created_epoch']['fr-fr'] = "créé"; $text['description-created_epoch']['en-us'] = "Created"; - $text['description-created_epoch']['es-cl'] = "Creación"; + $text['description-created_epoch']['es-cl'] = "Creación"; $text['description-created_epoch']['pt-pt'] = "Criada"; $text['description-created_epoch']['fr-fr'] = "Date de création"; diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index e5e3ffe269..79bc546704 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -66,6 +66,50 @@ else { $voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); } +//unassign the voicemail id copy from the voicemail id + if ($_GET["a"] == "delete" && strlen($voicemail_uuid) > 0 && strlen($_REQUEST["voicemail_destination_uuid"]) > 0) { + //set the variables + $voicemail_destination_uuid = check_str($_REQUEST["voicemail_destination_uuid"]); + //delete the voicemail from the destionations + $sqld = " + delete from + v_voicemail_destinations as d + where + d.voicemail_destination_uuid = '".$voicemail_destination_uuid."' and + d.voicemail_uuid = '".$voicemail_uuid."'"; + $db->exec(check_sql($sqld)); + //redirect the browser + $_SESSION["message"] = $text['message-delete']; + header("Location: voicemail_edit.php?id=".$voicemail_uuid); + return; + } + +//assign the voicemail id copy to the voicemail id + if (strlen($voicemail_uuid) > 0 && strlen($_REQUEST["voicemail_uuid_copy"]) > 0) { + //set the variables + $voicemail_uuid_copy = check_str($_REQUEST["voicemail_uuid_copy"]); + //assign the user to the extension + $sqli = " + insert into + v_voicemail_destinations + ( + voicemail_destination_uuid, + voicemail_uuid, + voicemail_uuid_copy + ) + values + ( + '".uuid()."', + '".$voicemail_uuid."', + '".$voicemail_uuid_copy."' + )"; + $db->exec(check_sql($sqli)); + //redirect the browser +// $_SESSION["message"] = $text['message-add']; +// header("Location: voicemail_edit.php?id=".$voicemail_uuid); +// return; + } + if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; @@ -163,7 +207,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { header("Location: voicemail_messages.php?".$referer_query); } else { - header("Location: voicemails.php"); + header("Location: voicemail_edit.php?id=".$voicemail_uuid); } return; } //if ($action == "update") @@ -315,6 +359,78 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; + if ($action == "update") { + echo " "; + echo " ".$text['label-copy_destinations'].":"; + echo " "; + + echo " \n"; + $sqls = " + select + v.voicemail_id, + d.voicemail_destination_uuid, + d.voicemail_uuid_copy + from + v_voicemails as v, + v_voicemail_destinations as d + where + d.voicemail_uuid_copy = v.voicemail_uuid and + v.domain_uuid = '".$_SESSION['domain_uuid']."' and + v.voicemail_enabled = 'true' and + d.voicemail_uuid = '".$voicemail_uuid."' + order by + v.voicemail_id asc"; + $prep_statement = $db->prepare(check_sql($sqls)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + $result_count = count($result); + foreach($result as $field) { + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + $voicemail_uuid_copied[] = $field['voicemail_uuid_copy']; + } + echo "
".$field['voicemail_id']."\n"; + echo " $v_link_label_delete\n"; + echo "
\n"; + + if (sizeof($voicemail_uuid_copied) > 0) { + // modify sql to remove already copied voicemail uuids from the list + $sqls_mod = " and v.voicemail_uuid not in ('".implode("','", $voicemail_uuid_copied)."') "; + } + echo "
\n"; + $sqls = " + select + v.voicemail_id, + v.voicemail_uuid + from + v_voicemails as v + where + v.domain_uuid = '".$_SESSION['domain_uuid']."' and + v.voicemail_enabled = 'true' and + v.voicemail_uuid <> '".$voicemail_uuid."' + ".$sqls_mod." + order by + v.voicemail_id asc"; + $prep_statement = $db->prepare(check_sql($sqls)); + $prep_statement->execute(); + echo " "; + echo " \n"; + unset($sql, $result); + echo "
\n"; + echo " ".$text['description-copy_destinations']."\n"; + echo "
\n"; + echo " "; + echo " "; + } + echo "\n"; echo "\n"; echo " ".$text['label-voicemail_enabled'].":\n";