diff --git a/admin/admin_settings.php b/admin/admin_settings.php index b3896d34..0203eb6a 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -2046,11 +2046,11 @@ if (defined('HESK_DEMO')) { - - diff --git a/admin/calendar.php b/admin/calendar.php index 0f87fe7d..04b5f047 100644 --- a/admin/calendar.php +++ b/admin/calendar.php @@ -31,7 +31,7 @@ define('IN_SCRIPT', 1); define('VALIDATOR', 1); define('HESK_PATH', '../'); -define('PAGE_TITLE', 'ADMIN_TOOLS'); +define('PAGE_TITLE', 'ADMIN_CALENDAR'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); @@ -494,6 +494,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');

+

+ 'month', + 1 => 'agendaWeek', + 2 => 'agendaDay', + ); + echo $view_array[$_SESSION['default_calendar_view']]; + ?> +

0, + 'agendaWeek' => 1, + 'agendaDay' => 2, +); +$default_view = $calendar_view_array[$modsForHesk_settings['default_calendar_view']]; /* Set default values */ $default_userdata = array( @@ -78,6 +85,7 @@ $default_userdata = array( 'notify_customer_new' => 1, 'notify_customer_reply' => 1, 'show_suggested' => 1, + 'default_calendar_view' => $default_view, // Notifications 'notify_new_unassigned' => 1, @@ -91,7 +99,6 @@ $default_userdata = array( 'notify_overdue_unassigned' => 0, ); -$modsForHesk_settings = mfh_getSettings(); /* A list of all categories */ $orderBy = $modsForHesk_settings['category_order_column']; $hesk_settings['categories'] = array(); @@ -518,7 +525,8 @@ function new_user() `notify_note_unassigned`, `notify_overdue_unassigned`, `autorefresh`, - `permission_template`) VALUES ( + `permission_template`, + `default_calendar_view`) VALUES ( '" . hesk_dbEscape($myuser['user']) . "', '" . hesk_dbEscape($myuser['pass']) . "', '" . intval($myuser['isadmin']) . "', @@ -543,7 +551,8 @@ function new_user() '" . ($myuser['notify_note_unassigned']) . "', '" . ($myuser['notify_overdue_unassigned']) . "', " . intval($myuser['autorefresh']) . ", - " . intval($myuser['template']) . ")"); + " . intval($myuser['template']) . ", + " . intval($myuser['default_calendar_view']) . ")"); $_SESSION['seluser'] = hesk_dbInsertID(); @@ -668,7 +677,8 @@ function update_user() `notify_note_unassigned`='" . ($myuser['notify_note_unassigned']) . "', `notify_overdue_unassigned`='" . ($myuser['notify_overdue_unassigned']) . "', `autorefresh`=" . intval($myuser['autorefresh']) . ", - `permission_template`=" . intval($myuser['template']) . " + `permission_template`=" . intval($myuser['template']) . ", + `default_calendar_view`=" . intval($myuser['default_calendar_view']) . " WHERE `id`='" . intval($myuser['id']) . "' LIMIT 1"); // If they are now inactive, remove any manager rights @@ -769,6 +779,7 @@ function hesk_validateUserInfo($pass_required = 1, $redirect_to = './manage_user $myuser['notify_customer_new'] = isset($_POST['notify_customer_new']) ? 1 : 0; $myuser['notify_customer_reply'] = isset($_POST['notify_customer_reply']) ? 1 : 0; $myuser['show_suggested'] = isset($_POST['show_suggested']) ? 1 : 0; + $myuser['default_calendar_view'] = hesk_POST('default-calendar-view', 0); /* Notifications */ $myuser['notify_new_unassigned'] = empty($_POST['notify_new_unassigned']) ? 0 : 1; diff --git a/admin/profile.php b/admin/profile.php index d5bb469e..03841dfc 100644 --- a/admin/profile.php +++ b/admin/profile.php @@ -230,6 +230,9 @@ function update_profile() /* Auto-start ticket timer */ $_SESSION['new']['autostart'] = isset($_POST['autostart']) ? 1 : 0; + /* Default calendar view */ + $_SESSION['new']['default_calendar_view'] = hesk_POST('default-calendar-view', 0); + /* Update auto-refresh time */ $_SESSION['new']['autorefresh'] = isset($_POST['autorefresh']) ? $_POST['autorefresh'] : 0; @@ -277,7 +280,8 @@ function update_profile() `notify_customer_new`='" . $_SESSION['new']['notify_customer_new'] . "', `notify_customer_reply`='" . $_SESSION['new']['notify_customer_reply'] . "', `notify_overdue_unassigned`='" . $_SESSION['new']['notify_overdue_unassigned'] . "', - `show_suggested`='" . $_SESSION['new']['show_suggested'] . "' + `show_suggested`='" . $_SESSION['new']['show_suggested'] . "', + `default_calendar_view`=" . intval($_SESSION['new']['default_calendar_view']) . " WHERE `id`='" . intval($_SESSION['id']) . "' LIMIT 1" ); diff --git a/calendar.php b/calendar.php index 141c0a9f..71dd1046 100644 --- a/calendar.php +++ b/calendar.php @@ -122,4 +122,6 @@ require_once(HESK_PATH . 'inc/header.inc.php');

+

+

\ No newline at end of file diff --git a/cron/calendar_reminders.php b/cron/calendar_reminders.php index 3cf1b261..1cd8d710 100644 --- a/cron/calendar_reminders.php +++ b/cron/calendar_reminders.php @@ -26,6 +26,9 @@ if (hesk_check_maintenance(false)) { hesk_load_cron_database_functions(); hesk_dbConnect(); +$modsForHesk_settings = mfh_getSettings(); +$skip_events = $modsForHesk_settings['enable_calendar'] == 0; + if ($hesk_settings['debug_mode']) { echo "Starting Calendar Reminders...\n"; } @@ -60,19 +63,18 @@ $sql = "SELECT `reminder`.`id` AS `reminder_id`, `reminder`.`user_id` AS `user_i AND `email_sent` = '0'"; $rs = hesk_dbQuery($sql); -$modsForHesk_settings = mfh_getSettings(); $reminders_to_flag = []; $tickets_to_flag = []; $included_email_functions = false; -if (hesk_dbNumRows($rs) > 0) { +if (hesk_dbNumRows($rs) > 0 && !$skip_events) { require(HESK_PATH . 'inc/email_functions.inc.php'); $included_email_functions = true; } $successful_emails = 0; $failed_emails = 0; -while ($row = hesk_dbFetchAssoc($rs)) { +while ($row = hesk_dbFetchAssoc($rs) && !$skip_events) { if (mfh_sendCalendarReminder($row, $modsForHesk_settings)) { $reminders_to_flag[] = $row['reminder_id']; $successful_emails++; diff --git a/css/mods-for-hesk.css b/css/mods-for-hesk.css index c22d8d30..64c16af4 100644 --- a/css/mods-for-hesk.css +++ b/css/mods-for-hesk.css @@ -295,6 +295,10 @@ div.setupButtons { color: blue; } +.black { + color: black; +} + .pad-down-20 { padding-top: 20px; } diff --git a/inc/header.inc.php b/inc/header.inc.php index f5f43efc..f9478981 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -320,10 +320,12 @@ if ($modsForHesk_settings['show_icons']) { if (defined('PAGE_TITLE') && PAGE_TITLE == 'CUSTOMER_CALENDAR') { $active = ' active'; } + if ($modsForHesk_settings['enable_calendar'] == 1): ?> -
  • > Calendar
  • + diff --git a/inc/profile_functions.inc.php b/inc/profile_functions.inc.php index b15a6710..cf42682f 100644 --- a/inc/profile_functions.inc.php +++ b/inc/profile_functions.inc.php @@ -319,12 +319,31 @@ function hesk_profile_tab($session_array = 'new', $is_profile_page = true, $acti +
    + +
    + +
    +
    diff --git a/inc/show_admin_nav.inc.php b/inc/show_admin_nav.inc.php index 79a7608d..d58b2434 100644 --- a/inc/show_admin_nav.inc.php +++ b/inc/show_admin_nav.inc.php @@ -145,6 +145,13 @@ if (hesk_check_kb_only(false)) { echo ' ' . $hesklang['menu_kb'] . ''; } } + if ($modsForHesk_settings['enable_calendar'] != 0) { + $active = ''; + if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_CALENDAR') { + $active = ' class="active"'; + } + echo ' ' . $hesklang['calendar_title_case'] . ''; + } if (hesk_checkPermission('can_run_reports', 0)) { $active = ''; if (defined('PAGE_TITLE') && PAGE_TITLE == 'ADMIN_REPORTS') { diff --git a/index.php b/index.php index 709c5b97..23d9110d 100644 --- a/index.php +++ b/index.php @@ -1348,11 +1348,11 @@ function print_start()
    +
    -
    + + + +
    + } + ?>
    diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index d6b1b689..55903c1d 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -741,6 +741,7 @@ function execute260Scripts() executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `usage` INT NOT NULL DEFAULT 0"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `notify_overdue_unassigned` ENUM('0', '1') NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ADD COLUMN `default_calendar_view` INT NOT NULL DEFAULT '0' AFTER `notify_note_unassigned`"); executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('enable_calendar', '1')"); executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('first_day_of_week', '0')"); executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`) VALUES ('default_calendar_view', 'month')"); diff --git a/js/calendar/mods-for-hesk-calendar-admin-readonly.js b/js/calendar/mods-for-hesk-calendar-admin-readonly.js index 869af40c..0ca95b0a 100644 --- a/js/calendar/mods-for-hesk-calendar-admin-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-admin-readonly.js @@ -9,6 +9,8 @@ $(document).ready(function() { eventLimit: true, timeFormat: 'H:mm', axisFormat: 'H:mm', + firstDay: $('#setting_first_day_of_week').text(), + defaultView: $('#setting_default_view').text().trim(), events: function(start, end, timezone, callback) { $.ajax({ url: getHelpdeskUrl() + '/internal-api/calendar/?start=' + start + '&end=' + end, diff --git a/js/calendar/mods-for-hesk-calendar-readonly.js b/js/calendar/mods-for-hesk-calendar-readonly.js index 869af40c..0ca95b0a 100644 --- a/js/calendar/mods-for-hesk-calendar-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-readonly.js @@ -9,6 +9,8 @@ $(document).ready(function() { eventLimit: true, timeFormat: 'H:mm', axisFormat: 'H:mm', + firstDay: $('#setting_first_day_of_week').text(), + defaultView: $('#setting_default_view').text().trim(), events: function(start, end, timezone, callback) { $.ajax({ url: getHelpdeskUrl() + '/internal-api/calendar/?start=' + start + '&end=' + end, diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js index fcb05806..a5b262dd 100644 --- a/js/calendar/mods-for-hesk-calendar.js +++ b/js/calendar/mods-for-hesk-calendar.js @@ -10,6 +10,7 @@ $(document).ready(function() { timeFormat: 'H:mm', axisFormat: 'H:mm', firstDay: $('#setting_first_day_of_week').text(), + defaultView: $('#setting_default_view').text().trim(), events: function(start, end, timezone, callback) { $.ajax({ url: getHelpdeskUrl() + '/internal-api/admin/calendar/?start=' + start + '&end=' + end, diff --git a/language/en/text.php b/language/en/text.php index 6841e021..3708232e 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -94,10 +94,11 @@ $hesklang['no_disable_calendar'] = 'NO, disable calendar'; $hesklang['first_day_of_week'] = 'First day of week'; $hesklang['first_day_of_week_help'] = 'This setting decides which day of the week to show first per week.'; $hesklang['calendar_disabled'] = 'The calendar is disabled'; -$hesklang['default_view'] = 'Default view'; +$hesklang['default_view'] = 'Default Calendar View'; $hesklang['default_view_help'] = 'Decide which view will be shown to customers and staff by default when viewing the calendar. Staff can change this setting via their own profile.'; $hesklang['week'] = 'Week'; -$hesklang['agenda'] = 'Agenda'; +$hesklang['calendar_day'] = 'Day'; +$hesklang['calendar_index'] = 'View upcoming events'; // ADDED OR MODIFIED IN Mods for HESK 2.5.2 $hesklang['manage_statuses'] = 'Manage Statuses';