From 1fd16bf07e6c954b948c23ed099da97548549bb6 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 90682f2025..1ad13ec024 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 4c15aec519..8ddc32ca49 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 @@ -588,6 +588,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); @@ -595,7 +600,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