Skip to content

Commit

Permalink
Prevent FullCalendar failure when default view is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault authored Feb 1, 2024
1 parent 93fa8e9 commit edbab1f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion js/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ var GLPIPlanning = {
timeZone: 'UTC',
theme: true,
weekNumbers: options.full_view ? true : false,
defaultView: options.default_view,
timeFormat: 'H:mm',
eventLimit: true, // show 'more' button when too mmany events
minTime: CFG_GLPI.planning_begin,
Expand Down Expand Up @@ -615,6 +614,12 @@ var GLPIPlanning = {
}
});

// Load the last known view only if it is valid (else load default view)
const view = this.calendar.isValidViewType(options.default_view) ?
options.default_view :
default_options.default_view;
this.calendar.changeView(view);

$('.planning_on_central a')
.mousedown(function() {
disable_qtip = true;
Expand Down

0 comments on commit edbab1f

Please sign in to comment.