From 23b05397e4e9b6eb355fa8d10674501bcf56de1f Mon Sep 17 00:00:00 2001 From: David Bourgault Date: Fri, 29 Jun 2018 16:15:11 -0400 Subject: [PATCH] Bug 17015: Improved UI readability * The calendar tool page no longer shows past holidays in the lists on the right side of the page. * Improved wording in the "Hints" --- Koha/DiscreteCalendar.pm | 10 ++++++++++ .../intranet-tmpl/prog/en/modules/tools/discrete_calendar.tt | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Koha/DiscreteCalendar.pm b/Koha/DiscreteCalendar.pm index c8c1e31..5914f0a 100644 --- a/Koha/DiscreteCalendar.pm +++ b/Koha/DiscreteCalendar.pm @@ -292,6 +292,7 @@ Returns an array of all the date objects that are unique holidays. sub get_unique_holidays { my $self = shift; + my $exclude_past = shift || 1; my $branchcode = $self->{branchcode}; my @unique_holidays; my $schema = Koha::Database->new->schema; @@ -304,6 +305,7 @@ sub get_unique_holidays { { select => [{ DATE => 'date' }, 'note' ], as => [qw/ date note/], + where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), } ); while (my $date = $rs->next()){ @@ -329,6 +331,7 @@ Returns an array of all the date objects that are float holidays. sub get_float_holidays { my $self = shift; + my $exclude_past = shift || 1; my $branchcode = $self->{branchcode}; my @float_holidays; my $schema = Koha::Database->new->schema; @@ -341,6 +344,7 @@ sub get_float_holidays { { select => [{ DATE => 'date' }, 'note' ], as => [qw/ date note/], + where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), } ); while (my $date = $rs->next()){ @@ -366,6 +370,7 @@ Returns an array of all the date objects that are float holidays in need of vali sub get_need_validation_holidays { my $self = shift; + my $exclude_past = shift || 1; my $branchcode = $self->{branchcode}; my @need_validation_holidays; my $schema = Koha::Database->new->schema; @@ -378,6 +383,7 @@ sub get_need_validation_holidays { { select => [{ DATE => 'date' }, 'note' ], as => [qw/ date note/], + where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), } ); while (my $date = $rs->next()){ @@ -403,6 +409,7 @@ Returns an array of all the date objects that are repeatable holidays. sub get_repeatable_holidays { my $self = shift; + my $exclude_past = shift || 1; my $branchcode = $self->{branchcode}; my @repeatable_holidays; my $schema = Koha::Database->new->schema; @@ -416,6 +423,7 @@ sub get_repeatable_holidays { { select => \[ 'distinct DAY(date), MONTH(date), note'], as => [qw/ day month note/], + where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), } ); @@ -440,6 +448,7 @@ Returns an array of all the date objects that are weekly holidays. sub get_week_days_holidays { my $self = shift; + my $exclude_past = shift || 1; my $branchcode = $self->{branchcode}; my @week_days; my $schema = Koha::Database->new->schema; @@ -453,6 +462,7 @@ sub get_week_days_holidays { select => [{ DAYOFWEEK => 'date'}, 'note'], as => [qw/ weekday note /], distinct => 1, + where => ($exclude_past ? \[' date >= CURRENT_DATE()'] : {} ), } ); 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 9299b18..5c22266 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 @@ -1,11 +1,12 @@ +[% USE Asset %] [% USE Branches %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Tools › [% Branches.GetName( branch ) %] calendar [% INCLUDE 'doc-head-close.inc' %] [% INCLUDE 'calendar.inc' %] - - +[% Asset.css("css/datatables.css") %] +[% Asset.css("css/discretecalendar.css") %] [% INCLUDE 'datatables.inc' %] @@ -165,7 +166,7 @@
  • Click Save to finish.
  • PS:
  • @@ -301,7 +302,7 @@ [% MACRO jsinclude BLOCK %] - +[% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") %]