From c78d3001454120f10e1fc5316b8fa4a209c30c6c Mon Sep 17 00:00:00 2001 From: fusionate Date: Tue, 16 Jul 2024 11:12:27 -0600 Subject: [PATCH] Voicemail - Messages: New permission to control visibility of Transcribe feature. --- app/voicemails/app_config.php | 3 +++ app/voicemails/voicemail_messages.php | 18 ++++-------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/app/voicemails/app_config.php b/app/voicemails/app_config.php index 40434891e0..933ffef18c 100644 --- a/app/voicemails/app_config.php +++ b/app/voicemails/app_config.php @@ -101,6 +101,9 @@ $apps[$x]['permissions'][$y]['groups'][] = "user"; $apps[$x]['permissions'][$y]['groups'][] = "agent"; $y++; + $apps[$x]['permissions'][$y]['name'] = "voicemail_message_transcribe"; + $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; + $y++; $apps[$x]['permissions'][$y]['name'] = "voicemail_option_add"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "admin"; diff --git a/app/voicemails/voicemail_messages.php b/app/voicemails/voicemail_messages.php index f292da5ae6..375887d550 100644 --- a/app/voicemails/voicemail_messages.php +++ b/app/voicemails/voicemail_messages.php @@ -140,7 +140,7 @@ // no return, exit exit; case 'transcribe': - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) { + if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && is_array($voicemail_messages) && @sizeof($voicemail_messages) != 0) { $messages_transcribed = 0; foreach ($voicemail_messages as $voicemail_message) { if (!empty($voicemail_message['checked']) && $voicemail_message['checked'] == 'true' && is_uuid($voicemail_message['uuid']) && is_uuid($voicemail_message['voicemail_uuid'])) { @@ -281,16 +281,6 @@ unset($num_rows); //get the voicemail - //running $vm->messages() is used to get the count and then that information is used for paging and then we need to run $vm->messages() again to get the results with the paging - //when the messages method is run twice on the same object the second time fails so creating a new object resolves this issue. - $vm = new voicemail; - $vm->domain_uuid = $_SESSION['domain_uuid']; - if (!empty($voicemail_uuid) && is_uuid($voicemail_uuid)) { - $vm->voicemail_uuid = $voicemail_uuid; - } - else if (!empty($voicemail_id) && is_numeric($voicemail_id)) { - $vm->voicemail_id = $voicemail_id; - } $vm->order_by = $order_by; $vm->order = $order; $vm->offset = $offset; @@ -329,7 +319,7 @@ echo "
\n"; echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>$_SESSION['back'][$_SERVER['PHP_SELF']]]); $margin_left = false; - if ($transcribe_enabled == 'true' && !empty($transcribe_engine) && $num_rows) { + if (permission_exists('voicemail_message_transcribe') && $transcribe_enabled == 'true' && !empty($transcribe_engine) && $num_rows) { echo button::create(['type'=>'button','label'=>$text['button-transcribe'],'icon'=>'quote-right','id'=>'btn_transcribe','name'=>'btn_transcribe','collapse'=>'hide-xs','style'=>'display: none; margin-left: 15px;','onclick'=>"list_action_set('transcribe'); list_form_submit('form_list');"]); $margin_left = true; } @@ -434,7 +424,7 @@ //set the list row url as a variable $list_row_url = "javascript:recording_play('".escape($row['voicemail_message_uuid'])."','".$row['voicemail_id'].'|'.$row['voicemail_uuid']."','message');"; - + //playback progress bar echo "\n"; echo "\n"; // dummy row to maintain alternating background color @@ -531,4 +521,4 @@ //include the footer require_once "resources/footer.php"; -?> +?> \ No newline at end of file