From 7b15e7935aa543f4192cc983e8008aa637607f65 Mon Sep 17 00:00:00 2001 From: Charles Farmer Date: Tue, 3 Mar 2020 16:22:56 -0500 Subject: [PATCH] Bug 17015: (follow-up) accept Koha::Library objects in place of a branchcode string, always use the syspref 'dateformat' --- Koha/DiscreteCalendar.pm | 3 +++ .../prog/en/modules/tools/discrete_calendar.tt | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Koha/DiscreteCalendar.pm b/Koha/DiscreteCalendar.pm index 06b620a78b..27c8a8c6c4 100644 --- a/Koha/DiscreteCalendar.pm +++ b/Koha/DiscreteCalendar.pm @@ -83,6 +83,9 @@ sub new { if ( !defined $self->{branchcode} ) { croak 'No branchcode argument passed to Koha::DiscreteCalendar->new'; } + if ( ref $self->{branchcode} eq 'Koha::Library' ) { + $self->{branchcode} = $self->{branchcode}->branchcode; + } $self->_init(); return $self; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt index 3417746a16..a50bc76e32 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt @@ -593,6 +593,11 @@ $(this).parent().find(".hint").toggle(); return false; }); //Set the correct coloring, default date and the date ranges for all datepickers + [% IF (dateformat == 'metric') %][% datepickerformat = 'dd/mm/yy' %] + [% ELSIF (dateformat == 'us' ) %][% datepickerformat = 'mm/dd/yy' %] + [% ELSIF (dateformat == 'iso' ) %][% datepickerformat = 'yy-mm-dd' %] + [% ELSIF (dateformat == 'dmydot') %][% datepickerformat = 'dd.mm.yy' %] + [% END %] $.datepicker.setDefaults({ beforeShowDay: function(thedate) { return dateStatusHandler(thedate); @@ -600,7 +605,7 @@ defaultDate: new Date("[% keydate %]"), minDate: new Date("[% minDate %]"), maxDate: new Date("[% maxDate %]"), - dateFormat: "yy-mm-dd" + dateFormat: "[% datepickerformat %]" }); //Main datepicker $("#jcalendar-container").datepicker({ -- 2.17.1