From 2980555287c3e30b245aaf50912d399b4bc35c83 Mon Sep 17 00:00:00 2001 From: fusionate Date: Wed, 18 Jan 2023 22:25:55 +0000 Subject: [PATCH] Call Broadcast: Implement Date/Time Picker for Start Time field. --- app/call_broadcast/app_languages.php | 14 +++++++------- app/call_broadcast/call_broadcast.php | 7 +++++++ app/call_broadcast/call_broadcast_edit.php | 15 ++++++++++++--- themes/default/template.php | 1 + 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/app/call_broadcast/app_languages.php b/app/call_broadcast/app_languages.php index 92b7d2e43d..64e9620947 100644 --- a/app/call_broadcast/app_languages.php +++ b/app/call_broadcast/app_languages.php @@ -401,8 +401,8 @@ $text['label-broadcast_toll_allow']['ru-ru'] = "Разрешить Платно $text['label-broadcast_toll_allow']['sv-se'] = "Toll Allow"; $text['label-broadcast_toll_allow']['uk-ua'] = ""; -$text['label-accountcode']['en-us'] = "Accountcode"; -$text['label-accountcode']['en-gb'] = "Accountcode"; +$text['label-accountcode']['en-us'] = "Account Code"; +$text['label-accountcode']['en-gb'] = "Account Code"; $text['label-accountcode']['ar-eg'] = ""; $text['label-accountcode']['de-at'] = "Kontoschlüssel"; //copied from de-de $text['label-accountcode']['de-ch'] = "Kontoschlüssel"; //copied from de-de @@ -464,7 +464,7 @@ $text['label-list_example']['ru-ru'] = "Number|First,Last\nNumber|First,Last\n.. $text['label-list_example']['sv-se'] = "Number|First,Last\nNumber|First,Last\n..."; $text['label-list_example']['uk-ua'] = "Number|First,Last\nNumber|First,Last\n..."; -$text['description-start_time']['en-us'] = "Is the time in seconds to start sending calls."; +$text['description-start_time']['en-us'] = "The date and time to begin sending calls."; $text['description-start_time']['en-gb'] = ""; $text['description-start_time']['ar-eg'] = ""; $text['description-start_time']['de-at'] = ""; //copied from de-de @@ -477,7 +477,7 @@ $text['description-start_time']['fr-fr'] = ""; $text['description-start_time']['he-il'] = ""; $text['description-start_time']['it-it'] = ""; $text['description-start_time']['nl-nl'] = ""; -$text['description-start_time']['pl-pl'] = "Jest to czas w sekundach, po którym rozpocznie się wysyłanie połączeń"; +$text['description-start_time']['pl-pl'] = "Data i godzina, aby rozpocząć wysyłanie połączeń."; $text['description-start_time']['pt-br'] = ""; //copied from pt-pt $text['description-start_time']['pt-pt'] = ""; $text['description-start_time']['ro-ro'] = ""; @@ -485,7 +485,7 @@ $text['description-start_time']['ru-ru'] = ""; $text['description-start_time']['sv-se'] = ""; $text['description-start_time']['uk-ua'] = ""; -$text['description-accountcode']['en-us'] = "Account code used most often used for billing systems."; +$text['description-accountcode']['en-us'] = "Used most often for billing systems."; $text['description-accountcode']['en-gb'] = ""; $text['description-accountcode']['ar-eg'] = ""; $text['description-accountcode']['de-at'] = ""; //copied from de-de @@ -590,8 +590,8 @@ $text['description-info']['ru-ru'] = "Введите описание"; $text['description-info']['sv-se'] = "Ange beskrivning här."; $text['description-info']['uk-ua'] = "Введіть опис"; -$text['description-destination']['en-us'] = "Send the call to the extension an IVR Menu, Conference Room, or any other number."; -$text['description-destination']['en-gb'] = "Send the call to the extension an IVR Menu, Conference Room, or any other number."; +$text['description-destination']['en-us'] = "Send the call to an extension, an IVR Menu, Conference Room, or any other number."; +$text['description-destination']['en-gb'] = "Send the call to an extension, an IVR Menu, Conference Room, or any other number."; $text['description-destination']['ar-eg'] = ""; $text['description-destination']['de-at'] = "Der Anruf wird an eine Nebenstelle, eine Automatische Vermittlung, ein Konferenzraum oder jede andere Nummer weitergeleitet."; //copied from de-de $text['description-destination']['de-ch'] = "Der Anruf wird an eine Nebenstelle, eine Automatische Vermittlung, ein Konferenzraum oder jede andere Nummer weitergeleitet."; //copied from de-de diff --git a/app/call_broadcast/call_broadcast.php b/app/call_broadcast/call_broadcast.php index ca5c2a64dc..c5fedb6a9b 100644 --- a/app/call_broadcast/call_broadcast.php +++ b/app/call_broadcast/call_broadcast.php @@ -191,6 +191,7 @@ } echo th_order_by('broadcast_name', $text['label-name'], $order_by, $order); echo th_order_by('broadcast_concurrent_limit', $text['label-concurrent-limit'], $order_by, $order); + echo th_order_by('broadcast_start_time', $text['label-start_time'], $order_by, $order); echo th_order_by('broadcast_description', $text['label-description'], $order_by, $order); if (permission_exists('call_broadcast_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo "  \n"; @@ -228,6 +229,12 @@ } echo " \n"; echo " ".escape($row['broadcast_concurrent_limit'])."\n"; + //determine start date and time + $broadcast_start_reference = $row['update_date'] ?: $row['insert_date']; + if ($row['broadcast_start_time'] && $broadcast_start_reference) { + $broadcast_start_time = date('Y-m-d H:i', strtotime($broadcast_start_reference) + $row['broadcast_start_time']); + } + echo " ".escape($broadcast_start_time)."\n"; echo " ".escape($row['broadcast_description'])."\n"; if (permission_exists('call_broadcast_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') { echo " "; diff --git a/app/call_broadcast/call_broadcast_edit.php b/app/call_broadcast/call_broadcast_edit.php index b5d6cf5f6d..3808974f70 100644 --- a/app/call_broadcast/call_broadcast_edit.php +++ b/app/call_broadcast/call_broadcast_edit.php @@ -227,7 +227,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //common array items $array['call_broadcasts'][0]['domain_uuid'] = $domain_uuid; $array['call_broadcasts'][0]['broadcast_name'] = $broadcast_name; - $array['call_broadcasts'][0]['broadcast_start_time'] = $broadcast_start_time; + $array['call_broadcasts'][0]['broadcast_start_time'] = strtotime($broadcast_start_time) - strtotime('now') >= 0 ? strtotime($broadcast_start_time) - strtotime('now') : null; $array['call_broadcasts'][0]['broadcast_timeout'] = strlen($broadcast_timeout) != 0 ? $broadcast_timeout : null; $array['call_broadcasts'][0]['broadcast_concurrent_limit'] = strlen($broadcast_concurrent_limit) != 0 ? $broadcast_concurrent_limit : null; $array['call_broadcasts'][0]['broadcast_caller_id_name'] = $broadcast_caller_id_name; @@ -280,6 +280,15 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $broadcast_accountcode = $row["broadcast_accountcode"]; $broadcast_description = $row["broadcast_description"]; $broadcast_toll_allow = $row["broadcast_toll_allow"]; + $insert_date = $row["insert_date"]; + $update_date = $row["update_date"]; + + //determine start date and time based on insert or update date and 'start time' delay (in seconds) + $broadcast_start_reference = $update_date ?: $insert_date; + if ($broadcast_start_time && $broadcast_start_reference) { + $broadcast_start_time = date('Y-m-d H:i', strtotime($broadcast_start_reference) + $broadcast_start_time); + } + } unset($sql, $parameters, $row); } @@ -333,8 +342,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo " ".$text['label-start_time']."\n"; echo "\n"; - echo "\n"; - echo " \n"; + echo "\n"; + echo " \n"; echo "
\n"; echo "".$text['description-start_time']."\n"; echo "\n"; diff --git a/themes/default/template.php b/themes/default/template.php index 4527f57939..ef2a23605f 100644 --- a/themes/default/template.php +++ b/themes/default/template.php @@ -601,6 +601,7 @@ //define formatting of individual classes $('.datepicker').datetimepicker({ format: 'YYYY-MM-DD', }); $('.datetimepicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm', }); + $('.datetimepicker-future').datetimepicker({ format: 'YYYY-MM-DD HH:mm', minDate: new Date(), }); $('.datetimesecpicker').datetimepicker({ format: 'YYYY-MM-DD HH:mm:ss', }); }); {/literal}