diff --git a/app/music_on_hold/app_config.php b/app/music_on_hold/app_config.php
index c49b7bd241..a87d5fc783 100644
--- a/app/music_on_hold/app_config.php
+++ b/app/music_on_hold/app_config.php
@@ -51,6 +51,9 @@
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
+ $apps[$x]['permissions'][$y]['name'] = "music_on_hold_name";
+ $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+ $y++;
$apps[$x]['permissions'][$y]['name'] = "music_on_hold_domain";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
diff --git a/app/music_on_hold/app_languages.php b/app/music_on_hold/app_languages.php
index 16de802f5e..91bc0124dc 100644
--- a/app/music_on_hold/app_languages.php
+++ b/app/music_on_hold/app_languages.php
@@ -101,6 +101,17 @@ $text['message-nofiles']['uk'] = "Файлів не знайдено";
$text['message-nofiles']['de-at'] = "Es wurden keine Dateien gefunden.";
$text['message-nofiles']['he'] = "לא נמצאו קבצים";
+$text['message-missing_required_fields']['en-us'] = "Missing Required Fields";
+$text['message-missing_required_fields']['es-cl'] = "Missing Campos requeridos";
+$text['message-missing_required_fields']['pt-pt'] = "Faltando Campos obrigatórios";
+$text['message-missing_required_fields']['fr-fr'] = "Manquant Champs obligatoires";
+$text['message-missing_required_fields']['pt-br'] = "Faltando Campos obrigatórios";
+$text['message-missing_required_fields']['pl'] = "Brakujące pola wymagane";
+$text['message-missing_required_fields']['sv-se'] = "Saknas Obligatoriska fält";
+$text['message-missing_required_fields']['uk'] = "Відсутні поля обов'язкові для заповнення";
+$text['message-missing_required_fields']['de-at'] = "Fehlende Pflichtangaben ";
+$text['message-missing_required_fields']['he'] = "חסרים שדות חובה";
+
$text['message-event-socket']['en-us'] = "Connection to Event Socket failed.";
$text['message-event-socket']['es-cl'] = "Conexión a socket fallida.";
$text['message-event-socket']['pt-pt'] = "A Conexão ao Event Socket falhou.";
diff --git a/app/music_on_hold/music_on_hold_edit.php b/app/music_on_hold/music_on_hold_edit.php
index d9d08570e8..a355ac4726 100644
--- a/app/music_on_hold/music_on_hold_edit.php
+++ b/app/music_on_hold/music_on_hold_edit.php
@@ -56,45 +56,55 @@ else {
if (is_array($_POST) && sizeof($_POST) > 0) {
//retrieve posted values
- $moh_uuid = check_str($_POST['uuid']);
- $moh_shuffle = check_str($_POST['shuffle']);
- $moh_channels = check_str($_POST['channels']);
- $moh_interval = check_str($_POST['interval']);
- $moh_chime_list = check_str($_POST['chime_list']);
- $moh_chime_freq = check_str($_POST['chime_freq']);
- $moh_chime_max = check_str($_POST['chime_max']);
- $moh_domain_uuid = check_str($_POST['domain_uuid']);
- $moh_path = check_str($_POST['path']);
+ $moh = $_POST;
- //update the moh record
- $sql = "update v_music_on_hold set ";
- if (permission_exists('music_on_hold_domain')) {
- $sql .= "domain_uuid = ".(($moh_domain_uuid != '') ? "'".$moh_domain_uuid."'" : 'null').", ";
+ //check required fields
+ if (permission_exists('music_on_hold_name') && $moh['name'] == '') { $missing_fields[] = $text['label-name']; }
+ if (permission_exists('music_on_hold_path') && $moh['path'] == '') { $missing_fields[] = $text['label-path']; }
+ if (is_array($missing_fields) && sizeof($missing_fields > 0)) {
+ //set message
+ $_SESSION["message_mood"] = 'negative';
+ $_SESSION["message"] = $text['message-missing_required_fields'].': '.implode(', ', $missing_fields);
}
- if (permission_exists('music_on_hold_path')) {
- $sql .= "music_on_hold_path = ".(($moh_path != '') ? "'".$moh_path."'" : '$${sounds_dir}/music').", ";
- }
- $sql .= "music_on_hold_shuffle = '".$moh_shuffle."', ";
- $sql .= "music_on_hold_channels = ".$moh_channels.", ";
- $sql .= "music_on_hold_interval = ".(($moh_interval != '') ? $moh_interval : '20').", ";
- $sql .= "music_on_hold_timer_name = 'soft', ";
- $sql .= "music_on_hold_chime_list = '".$moh_chime_list."', ";
- $sql .= "music_on_hold_chime_freq = ".(($moh_chime_freq != '') ? $moh_chime_freq : 'null').", ";
- $sql .= "music_on_hold_chime_max = ".(($moh_chime_max != '') ? $moh_chime_max : 'null')." ";
- $sql .= "where music_on_hold_uuid = '".$moh_uuid."' ";
- if (!permission_exists('music_on_hold_domain')) {
- $sql .= "and domain_uuid = '".$domain_uuid."' ";
- }
- //echo $sql."
"; exit;
- $db->exec(check_sql($sql));
- unset($sql);
+ else {
+ //check strings
+ foreach ($_POST as $field => $value) {
+ $moh[$field] = check_str($value);
+ }
- //set message
- $_SESSION["message"] = $text['message-update'];
+ //update the moh record
+ $sql = "update v_music_on_hold set ";
+ if (permission_exists('music_on_hold_domain')) {
+ $sql .= "domain_uuid = ".(($moh['domain_uuid'] != '') ? "'".$moh['domain_uuid']."'" : 'null').", ";
+ }
+ if (permission_exists('music_on_hold_name')) {
+ $sql .= "music_on_hold_name = '".$moh['name']."', ";
+ }
+ if (permission_exists('music_on_hold_path')) {
+ $sql .= "music_on_hold_path = ".(($moh['path'] != '') ? "'".$moh['path']."'" : '$${sounds_dir}/music').", ";
+ }
+ $sql .= "music_on_hold_shuffle = '".$moh['shuffle']."', ";
+ $sql .= "music_on_hold_channels = ".$moh['channels'].", ";
+ $sql .= "music_on_hold_interval = ".(($moh['interval'] != '') ? $moh['interval'] : '20').", ";
+ $sql .= "music_on_hold_timer_name = 'soft', ";
+ $sql .= "music_on_hold_chime_list = '".$moh['chime_list']."', ";
+ $sql .= "music_on_hold_chime_freq = ".(($moh['chime_freq'] != '') ? $moh['chime_freq'] : 'null').", ";
+ $sql .= "music_on_hold_chime_max = ".(($moh['chime_max'] != '') ? $moh['chime_max'] : 'null')." ";
+ $sql .= "where music_on_hold_uuid = '".$moh['uuid']."' ";
+ if (!permission_exists('music_on_hold_domain')) {
+ $sql .= "and domain_uuid = '".$domain_uuid."' ";
+ }
+ //echo $sql."
"; exit;
+ $db->exec(check_sql($sql));
+ unset($sql);
- //redirect
- header("Location: music_on_hold.php");
- exit;
+ //set message
+ $_SESSION["message"] = $text['message-update'];
+
+ //redirect
+ header("Location: music_on_hold.php");
+ exit;
+ }
}
//show the header
@@ -146,6 +156,17 @@ if (is_array($_POST) && sizeof($_POST) > 0) {
echo "
| \n"; + echo " ".$text['label-name']."\n"; + echo " | \n"; + echo "\n"; + echo " \n"; + echo " | \n"; + echo "|
| \n"; echo " ".$text['label-shuffle']."\n"; @@ -317,7 +338,7 @@ if (is_array($_POST) && sizeof($_POST) > 0) { if (permission_exists('music_on_hold_path')) { echo " | ||
| \n"; + echo " | \n"; echo " ".$text['label-path']."\n"; echo " | \n"; echo "\n"; |