From a118cd658e1be44b88cfd4a20c1717fe66313003 Mon Sep 17 00:00:00 2001 From: fusionate Date: Thu, 9 Jan 2025 23:04:03 -0700 Subject: [PATCH] Voicemail - Edit: Change boolean select elements to toggle switches. --- app/voicemails/voicemail_edit.php | 118 +++++++++++++++++++++--------- 1 file changed, 83 insertions(+), 35 deletions(-) diff --git a/app/voicemails/voicemail_edit.php b/app/voicemails/voicemail_edit.php index 8ed1b8a675..4785ad81da 100644 --- a/app/voicemails/voicemail_edit.php +++ b/app/voicemails/voicemail_edit.php @@ -97,12 +97,12 @@ $voicemail_sms_to = $_POST["voicemail_sms_to"] ?? null; $voicemail_transcription_enabled = $_POST["voicemail_transcription_enabled"] ?? null; $voicemail_file = $_POST["voicemail_file"]; - $voicemail_local_after_email = $_POST["voicemail_local_after_email"]; + $voicemail_local_after_email = $_POST["voicemail_local_after_email"] ?? null; $voicemail_destination = $_POST["voicemail_destination"]; - $voicemail_local_after_forward = $_POST["voicemail_local_after_forward"]; + $voicemail_local_after_forward = $_POST["voicemail_local_after_forward"] ?? null; $voicemail_enabled = $_POST["voicemail_enabled"] ?? 'false'; $voicemail_description = $_POST["voicemail_description"]; - $voicemail_tutorial = $_POST["voicemail_tutorial"]; + $voicemail_tutorial = $_POST["voicemail_tutorial"] ?? null; $voicemail_recording_instructions = $_POST["voicemail_recording_instructions"] ?? null; $voicemail_recording_options = $_POST["voicemail_recording_options"] ?? null; $voicemail_options_delete = $_POST["voicemail_options_delete"] ?? null; @@ -153,7 +153,7 @@ $voicemail_uuid = uuid(); //if adding a mailbox and don't have the transcription permission, set the default transcribe behavior if (!permission_exists('voicemail_transcription_enabled') && isset($_SESSION['voicemail']['transcription_enabled_default']['boolean'])) { - $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean']; + $voicemail_transcription_enabled = $_SESSION['voicemail']['transcription_enabled_default']['boolean'] ?? 'false'; } } @@ -167,30 +167,30 @@ $array['voicemails'][0]['voicemail_mail_to'] = $voicemail_mail_to; $array['voicemails'][0]['voicemail_sms_to'] = $voicemail_sms_to; $array['voicemails'][0]['voicemail_transcription_enabled'] = $voicemail_transcription_enabled; - $array['voicemails'][0]['voicemail_tutorial'] = $voicemail_tutorial; + $array['voicemails'][0]['voicemail_tutorial'] = $voicemail_tutorial ?? 'false'; if (permission_exists('voicemail_recording_instructions')) { - $array['voicemails'][0]['voicemail_recording_instructions'] = $voicemail_recording_instructions; + $array['voicemails'][0]['voicemail_recording_instructions'] = $voicemail_recording_instructions ?? 'false'; } if (permission_exists('voicemail_recording_options')) { - $array['voicemails'][0]['voicemail_recording_options'] = $voicemail_recording_options; + $array['voicemails'][0]['voicemail_recording_options'] = $voicemail_recording_options ?? 'false'; } if (permission_exists('voicemail_file')) { $array['voicemails'][0]['voicemail_file'] = $voicemail_file; } if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) { - $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email; + $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_email ?? 'false'; } else if (permission_exists('voicemail_local_after_forward')) { - $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_forward; + $array['voicemails'][0]['voicemail_local_after_email'] = $voicemail_local_after_forward ?? 'false'; } else { $array['voicemails'][0]['voicemail_local_after_email'] = 'true'; } if (permission_exists('voicemail_local_after_forward')) { - $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_forward; + $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_forward ?? 'false'; } else if (permission_exists('voicemail_local_after_email') && !empty($voicemail_mail_to)) { - $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_email; + $array['voicemails'][0]['voicemail_local_after_forward'] = $voicemail_local_after_email ?? 'false'; } else { $array['voicemails'][0]['voicemail_local_after_forward'] = 'true'; @@ -583,10 +583,18 @@ echo " ".$text['label-voicemail_tutorial']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-voicemail_tutorial']."\n"; echo "\n"; @@ -683,10 +691,18 @@ echo " ".$text['label-recording_instructions']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-recording_instructions']."\n"; echo "\n"; @@ -699,10 +715,18 @@ echo " ".$text['label-recording_options']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-recording_options']."\n"; echo "\n"; @@ -820,10 +844,18 @@ echo " ".$text['label-voicemail_transcription_enabled']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-voicemail_transcription_enabled']."\n"; echo "\n"; @@ -856,10 +888,18 @@ echo " ".$text['label-voicemail_local_after_email']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-voicemail_local_after_email']."\n"; echo "\n"; @@ -927,10 +967,18 @@ echo " ".$text['label-voicemail_local_after_forward']."\n"; echo "\n"; echo "\n"; - echo " \n"; + if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') { + echo " \n"; + } + else { + echo " \n"; + } echo "
\n"; echo $text['description-voicemail_local_after_forward']."\n"; echo "\n";