From 5d00d0b91f8762c6651c0dadd1a0bd14720ed2eb Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Mon, 26 Jan 2026 20:04:20 -0700 Subject: [PATCH] Voicemail Greeting save the greeting_voice - Add the select_group_option --- app/voicemail_greetings/app_config.php | 7 ++- .../voicemail_greeting_edit.php | 51 +++++++++++++++++-- 2 files changed, 51 insertions(+), 7 deletions(-) diff --git a/app/voicemail_greetings/app_config.php b/app/voicemail_greetings/app_config.php index 9314724748..7a5320a779 100644 --- a/app/voicemail_greetings/app_config.php +++ b/app/voicemail_greetings/app_config.php @@ -102,6 +102,11 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "greeting_voice"; + $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; $apps[$x]['db'][$y]['fields'][$z]['name'] = "greeting_message"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['search'] = 'true'; @@ -142,5 +147,3 @@ $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; - -?> \ No newline at end of file diff --git a/app/voicemail_greetings/voicemail_greeting_edit.php b/app/voicemail_greetings/voicemail_greeting_edit.php index e70036fd73..80ac9ca895 100644 --- a/app/voicemail_greetings/voicemail_greeting_edit.php +++ b/app/voicemail_greetings/voicemail_greeting_edit.php @@ -65,6 +65,14 @@ //$translate_enabled = $speech->get_translate_enabled(); //$language_enabled = $speech->get_language_enabled(); //$languages = $speech->get_languages(); + + // Determine the aray type single, or multi + $voices_array_type = array_type($voices); + + // Sort the array by language code keys alphabetically + if ($voices_array_type == 'multi') { + ksort($voices); + } } //add the transcribe object and get the languages arrays @@ -234,6 +242,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { $array['voicemail_greetings'][0]['voicemail_id'] = $voicemail_id; $array['voicemail_greetings'][0]['greeting_id'] = $greeting_id; $array['voicemail_greetings'][0]['greeting_name'] = $greeting_name; + $array['voicemail_greetings'][0]['greeting_voice'] = $greeting_voice; $array['voicemail_greetings'][0]['greeting_message'] = $greeting_message; $array['voicemail_greetings'][0]['greeting_filename'] = $greeting_filename; $array['voicemail_greetings'][0]['greeting_base64'] = $greeting_base64; @@ -268,6 +277,7 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { if (is_array($row) && @sizeof($row) != 0) { $greeting_id = $row["greeting_id"]; $greeting_name = $row["greeting_name"]; + $greeting_voice = $row["greeting_voice"]; $greeting_message = $row["greeting_message"]; $greeting_description = $row["greeting_description"]; } @@ -345,12 +355,43 @@ if (!empty($_POST) && empty($_POST["persistformvar"])) { echo "\n"; echo "\n"; if (!empty($voices) && is_array($voices)) { - echo " \n"; + echo " \n"; + foreach ($voices as $key => $voice) { + $greeting_voice_selected = (!empty($greeting_voice) && $key == $greeting_voice) ? "selected='selected'" : null; + echo " \n"; + } + echo " \n"; + } + if ($voices_array_type == 'multi') { + echo " \n"; + + // Select showing only optgroup labels + echo " \n"; + + // Select showing only options from selected group\n"; + echo " \n"; + + echo "\n"; } - echo " \n"; } else { echo " \n";