diff --git a/admin/admin_settings.php b/admin/admin_settings.php
index 8f9a5115..8ccfaea6 100644
--- a/admin/admin_settings.php
+++ b/admin/admin_settings.php
@@ -2220,6 +2220,106 @@ $modsForHesk_settings = mfh_getSettings();
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php
index ee1d8181..e52dd5a8 100644
--- a/admin/admin_settings_save.php
+++ b/admin/admin_settings_save.php
@@ -480,6 +480,7 @@ $set['navbar_title_url'] = hesk_POST('navbar_title_url');
$set['enable_calendar'] = hesk_checkMinMax(intval(hesk_POST('enable_calendar')), 0, 2, 2);
$set['first_day_of_week'] = hesk_POST('first-day-of-week', 0);
$set['default_view'] = hesk_POST('default-view', 'month');
+$set['calendar_show_start_time'] = hesk_POST('calendar-show-start-time', 'true');
if ($set['customer-email-verification-required']) {
//-- Don't allow multiple emails if verification is required
@@ -514,6 +515,13 @@ $set['admin_sidebar_text_hover'] = hesk_input(hesk_POST('admin-sidebar-text-hove
$set['login_background_type'] = hesk_input(hesk_POST('login-background'));
$set['login_box_header'] = hesk_input(hesk_POST('login-box-header'));
+$set['business_hours_sunday'] = hesk_POST_array('business-hours-sunday');
+$set['business_hours_monday'] = hesk_POST_array('business-hours-monday');
+$set['business_hours_tuesday'] = hesk_POST_array('business-hours-tuesday');
+$set['business_hours_wednesday'] = hesk_POST_array('business-hours-wednesday');
+$set['business_hours_thursday'] = hesk_POST_array('business-hours-thursday');
+$set['business_hours_friday'] = hesk_POST_array('business-hours-friday');
+$set['business_hours_saturday'] = hesk_POST_array('business-hours-saturday');
$changedBackground = false;
$loadedAttachmentFuncs = false;
@@ -655,6 +663,7 @@ mfh_updateSetting('use_mailgun', $set['use_mailgun'], false);
mfh_updateSetting('enable_calendar', $set['enable_calendar'], false);
mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false);
mfh_updateSetting('default_calendar_view', $set['default_view'], true);
+mfh_updateSetting('calendar_show_start_time', $set['calendar_show_start_time'], true);
mfh_updateSetting('admin_color_scheme', $set['admin_color_scheme'], true);
mfh_updateSetting('login_background_type', $set['login_background_type'], true);
@@ -667,6 +676,29 @@ if ($changedLoginImage) {
mfh_updateSetting('login_box_header_image', $set['login_box_header_image'], true);
}
+// Update business hours
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_sunday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_sunday'][1]) . "' WHERE `day_of_week` = " . intval(0));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_monday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_monday'][1]) . "' WHERE `day_of_week` = " . intval(1));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_tuesday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_tuesday'][1]) . "' WHERE `day_of_week` = " . intval(2));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_wednesday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_wednesday'][1]) . "' WHERE `day_of_week` = " . intval(3));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_thursday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_thursday'][1]) . "' WHERE `day_of_week` = " . intval(4));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_friday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_friday'][1]) . "' WHERE `day_of_week` = " . intval(5));
+hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ SET `start_time` = '" . hesk_dbEscape($set['business_hours_saturday'][0]) . "',
+ `end_time` = '" . hesk_dbEscape($set['business_hours_saturday'][1]) . "' WHERE `day_of_week` = " . intval(6));
+
// Prepare settings file and save it
$settings_file_content = '
+
+
+
+
+
";
diff --git a/install/migrations/core.php b/install/migrations/core.php
index 798f7fa9..c9473d3a 100644
--- a/install/migrations/core.php
+++ b/install/migrations/core.php
@@ -222,5 +222,8 @@ function getAllMigrations() {
164 => new \v330\ServiceMessagesImprovements\CreateServiceMessageToLocationTable(164),
165 => new \v330\ServiceMessagesImprovements\UpdateExistingServiceMessagesLocations(165),
166 => new \v330\ServiceMessagesImprovements\AddLanguageColumnToServiceMessages(166),
+ 167 => new \v330\CalendarImprovements\AddBusinessHoursTable(167),
+ 168 => new \v330\CalendarImprovements\InsertDefaultBusinessHours(168),
+ 169 => new \v330\CalendarImprovements\AddShowStartTimeSetting(169),
);
}
\ No newline at end of file
diff --git a/install/migrations/v330/CalendarImprovements/AddBusinessHoursTable.php b/install/migrations/v330/CalendarImprovements/AddBusinessHoursTable.php
new file mode 100644
index 00000000..42483d29
--- /dev/null
+++ b/install/migrations/v330/CalendarImprovements/AddBusinessHoursTable.php
@@ -0,0 +1,15 @@
+executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
+ (`day_of_week` INT NOT NULL, `start_time` VARCHAR(5) NOT NULL, `end_time` VARCHAR(5) NOT NULL)");
+ }
+
+ function innerDown($hesk_settings) {
+ $this->executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
+ }
+}
\ No newline at end of file
diff --git a/install/migrations/v330/CalendarImprovements/AddShowStartTimeSetting.php b/install/migrations/v330/CalendarImprovements/AddShowStartTimeSetting.php
new file mode 100644
index 00000000..89c0cd81
--- /dev/null
+++ b/install/migrations/v330/CalendarImprovements/AddShowStartTimeSetting.php
@@ -0,0 +1,17 @@
+executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`)
+ VALUES ('calendar_show_start_time', 'true')");
+ }
+
+ function innerDown($hesk_settings) {
+ $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings`
+ WHERE `Key` = 'calendar_show_start_time'");
+ }
+}
\ No newline at end of file
diff --git a/install/migrations/v330/CalendarImprovements/InsertDefaultBusinessHours.php b/install/migrations/v330/CalendarImprovements/InsertDefaultBusinessHours.php
new file mode 100644
index 00000000..970b59ca
--- /dev/null
+++ b/install/migrations/v330/CalendarImprovements/InsertDefaultBusinessHours.php
@@ -0,0 +1,28 @@
+executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (0, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (1, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (2, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (3, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (4, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (5, '00:00', '23:59')");
+ $this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
+ VALUES (6, '00:00', '23:59')");
+ }
+
+ function innerDown($hesk_settings) {
+ $this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
+ }
+}
\ No newline at end of file
diff --git a/js/calendar/mods-for-hesk-calendar-admin-readonly.js b/js/calendar/mods-for-hesk-calendar-admin-readonly.js
index 51f2b763..43ce1b43 100644
--- a/js/calendar/mods-for-hesk-calendar-admin-readonly.js
+++ b/js/calendar/mods-for-hesk-calendar-admin-readonly.js
@@ -12,6 +12,44 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
+ displayEventTime: $('#setting_show_start_time').text(),
+ businessHours: [
+ {
+ dow: [0],
+ start: $('#business_hours_0_start').text(),
+ end: $('#business_hours_0_end').text()
+ },
+ {
+ dow: [1],
+ start: $('#business_hours_1_start').text(),
+ end: $('#business_hours_1_end').text()
+ },
+ {
+ dow: [2],
+ start: $('#business_hours_2_start').text(),
+ end: $('#business_hours_2_end').text()
+ },
+ {
+ dow: [3],
+ start: $('#business_hours_3_start').text(),
+ end: $('#business_hours_3_end').text()
+ },
+ {
+ dow: [4],
+ start: $('#business_hours_4_start').text(),
+ end: $('#business_hours_4_end').text()
+ },
+ {
+ dow: [5],
+ start: $('#business_hours_5_start').text(),
+ end: $('#business_hours_5_end').text()
+ },
+ {
+ dow: [6],
+ start: $('#business_hours_6_start').text(),
+ end: $('#business_hours_6_end').text()
+ }
+ ],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
diff --git a/js/calendar/mods-for-hesk-calendar-readonly.js b/js/calendar/mods-for-hesk-calendar-readonly.js
index a282c155..72774ce5 100644
--- a/js/calendar/mods-for-hesk-calendar-readonly.js
+++ b/js/calendar/mods-for-hesk-calendar-readonly.js
@@ -12,6 +12,44 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
+ displayEventTime: $('#setting_show_start_time').text(),
+ businessHours: [
+ {
+ dow: [0],
+ start: $('#business_hours_0_start').text(),
+ end: $('#business_hours_0_end').text()
+ },
+ {
+ dow: [1],
+ start: $('#business_hours_1_start').text(),
+ end: $('#business_hours_1_end').text()
+ },
+ {
+ dow: [2],
+ start: $('#business_hours_2_start').text(),
+ end: $('#business_hours_2_end').text()
+ },
+ {
+ dow: [3],
+ start: $('#business_hours_3_start').text(),
+ end: $('#business_hours_3_end').text()
+ },
+ {
+ dow: [4],
+ start: $('#business_hours_4_start').text(),
+ end: $('#business_hours_4_end').text()
+ },
+ {
+ dow: [5],
+ start: $('#business_hours_5_start').text(),
+ end: $('#business_hours_5_end').text()
+ },
+ {
+ dow: [6],
+ start: $('#business_hours_6_start').text(),
+ end: $('#business_hours_6_end').text()
+ }
+ ],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js
index 4cf6ebe9..08f1b4f4 100644
--- a/js/calendar/mods-for-hesk-calendar.js
+++ b/js/calendar/mods-for-hesk-calendar.js
@@ -12,6 +12,44 @@ $(document).ready(function() {
eventLimit: true,
timeFormat: 'H:mm',
axisFormat: 'H:mm',
+ displayEventTime: $('#setting_show_start_time').text() === 'true',
+ businessHours: [
+ {
+ dow: [0],
+ start: $('#business_hours_0_start').text(),
+ end: $('#business_hours_0_end').text()
+ },
+ {
+ dow: [1],
+ start: $('#business_hours_1_start').text(),
+ end: $('#business_hours_1_end').text()
+ },
+ {
+ dow: [2],
+ start: $('#business_hours_2_start').text(),
+ end: $('#business_hours_2_end').text()
+ },
+ {
+ dow: [3],
+ start: $('#business_hours_3_start').text(),
+ end: $('#business_hours_3_end').text()
+ },
+ {
+ dow: [4],
+ start: $('#business_hours_4_start').text(),
+ end: $('#business_hours_4_end').text()
+ },
+ {
+ dow: [5],
+ start: $('#business_hours_5_start').text(),
+ end: $('#business_hours_5_end').text()
+ },
+ {
+ dow: [6],
+ start: $('#business_hours_6_start').text(),
+ end: $('#business_hours_6_end').text()
+ }
+ ],
firstDay: $('#setting_first_day_of_week').text(),
defaultView: $('#setting_default_view').text().trim(),
events: function(start, end, timezone, callback) {
diff --git a/language/en/text.php b/language/en/text.php
index 51c2470a..8a621218 100644
--- a/language/en/text.php
+++ b/language/en/text.php
@@ -2230,6 +2230,11 @@ $hesklang['sm_view_kb_article'] = 'View Knowledgebase Article';
$hesklang['sm_submit_ticket'] = 'Submit Ticket';
$hesklang['sm_view_ticket'] = 'View Ticket';
$hesklang['sm_login_page'] = 'Login Page';
+$hesklang['business_hours'] = 'Business Hours';
+$hesklang['business_hours_help'] = 'Set business hours for the calendar. There is no functional change by setting this,
+but times outside of the defined business hours will have a darker gray background for increased visibility.';
+$hesklang['show_event_start_time'] = 'Show event start time in title';
+$hesklang['show_event_start_time_help'] = 'Always show the start time on event titles (unless the event is an all-day event).';
// DO NOT CHANGE BELOW
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');