Bugzilla – Attachment 156349 Details for
Bug 17015
New Koha Calendar
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17015: Add an option to view past holiday details in table
Bug-17015-Add-an-option-to-view-past-holiday-detai.patch (text/plain), 9.45 KB, created by
Emily-Rose Francoeur
on 2023-09-28 19:35:17 UTC
(
hide
)
Description:
Bug 17015: Add an option to view past holiday details in table
Filename:
MIME Type:
Creator:
Emily-Rose Francoeur
Created:
2023-09-28 19:35:17 UTC
Size:
9.45 KB
patch
obsolete
>From 1c8befe55eafab9388b8ed72444ee5aea80bd74a Mon Sep 17 00:00:00 2001 >From: Maryse Simard <maryse.simard@inlibro.com> >Date: Thu, 20 Oct 2022 16:52:19 -0400 >Subject: [PATCH] Bug 17015: Add an option to view past holiday details in > table > >--- > Koha/DiscreteCalendar.pm | 10 ++-- > .../en/modules/tools/discrete_calendar.tt | 59 ++++++++++++++++--- > tools/discrete_calendar.pl | 4 +- > 3 files changed, 59 insertions(+), 14 deletions(-) > >diff --git a/Koha/DiscreteCalendar.pm b/Koha/DiscreteCalendar.pm >index b6d4c3bfcc..6b5ef2c0f5 100644 >--- a/Koha/DiscreteCalendar.pm >+++ b/Koha/DiscreteCalendar.pm >@@ -337,7 +337,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 $exclude_past = shift // 1; > my $branchcode = $self->{branchcode}; > my @unique_holidays; > my $schema = Koha::Database->new->schema; >@@ -377,7 +377,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 $exclude_past = shift // 1; > my $branchcode = $self->{branchcode}; > my @float_holidays; > my $schema = Koha::Database->new->schema; >@@ -417,7 +417,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 $exclude_past = shift // 1; > my $branchcode = $self->{branchcode}; > my @need_validation_holidays; > my $schema = Koha::Database->new->schema; >@@ -457,7 +457,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 $exclude_past = shift // 1; > my $branchcode = $self->{branchcode}; > my @repeatable_holidays; > my $schema = Koha::Database->new->schema; >@@ -497,7 +497,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 $exclude_past = shift // 1; > my $branchcode = $self->{branchcode}; > my @week_days; > my $schema = Koha::Database->new->schema; >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 863d39c0cf..cfd6e4f359 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 >@@ -225,7 +225,7 @@ > <div id="holiday-list"> > [% IF ( NEED_VALIDATION_HOLIDAYS ) %] > <h3>Need validation holidays</h3> >- <table id="holidaysvalidation"> >+ <table id="holidaysvalidation" class="dataTable no-footer"> > <thead> > <tr> > <th class="validation">Date</th> >@@ -247,7 +247,7 @@ > > [% IF ( WEEKLY_HOLIDAYS ) %] > <h3>Weekly - Repeatable holidays</h3> >- <table id="holidayweeklyrepeatable"> >+ <table id="holidayweeklyrepeatable" class="dataTable no-footer"> > <thead> > <tr> > <th class="repeatableweekly">Day of week</th> >@@ -269,7 +269,7 @@ > > [% IF ( REPEATABLE_HOLIDAYS ) %] > <h3>Yearly - Repeatable holidays</h3> >- <table id="holidaysyearlyrepeatable"> >+ <table id="holidaysyearlyrepeatable" class="dataTable no-footer"> > <thead> > <tr> > [% IF ( dateformat == "metric" ) %] >@@ -299,7 +299,11 @@ > > [% IF ( UNIQUE_HOLIDAYS ) %] > <h3>Unique holidays</h3> >- <table id="holidaysunique"> >+ <label class="controls"> >+ <input type="checkbox" name="show_past" id="show_past_holidaysunique" class="show_past" /> >+ Show past entries >+ </label> >+ <table id="holidaysunique" class="dataTable no-footer"> > <thead> > <tr> > <th class="holiday">Date</th> >@@ -309,7 +313,7 @@ > </thead> > <tbody> > [% FOREACH HOLIDAYS_LOO IN UNIQUE_HOLIDAYS %] >- <tr> >+ <tr data-date="[% HOLIDAYS_LOO.date | html %]"> > <td><a href="#main" onclick="go_to_date('[% HOLIDAYS_LOO.date | html %]')"><span title="[% HOLIDAYS_LOO.DATE_SORT | html %]">[% HOLIDAYS_LOO.outputdate | html %]</span></a></td> > <td>[% HOLIDAYS_LOO.note | html %]</td> > <td>[% HOLIDAYS_LOO.description.replace('\\\r\\\n', '<br />') | html %]</td> >@@ -321,7 +325,11 @@ > > [% IF ( FLOAT_HOLIDAYS ) %] > <h3>Floating holidays</h3> >- <table id="holidaysfloat"> >+ <label class="controls"> >+ <input type="checkbox" name="show_past" id="show_past_holidaysfloat" class="show_past" /> >+ Show past entries >+ </label> >+ <table id="holidaysfloat" class="dataTable no-footer"> > <thead> > <tr> > <th class="float">Date</th> >@@ -331,7 +339,7 @@ > </thead> > <tbody> > [% FOREACH float_holiday IN FLOAT_HOLIDAYS %] >- <tr> >+ <tr data-date="[% float_holiday.date | html %]"> > <td><a href="#main" onclick="go_to_date('[% float_holiday.date | html %]')"><span title="[% float_holiday.DATE_SORT | html %]">[% float_holiday.outputdate | html %]</span></a></td> > <td>[% float_holiday.note | html %]</td> > <td>[% float_holiday.description.replace('\\\r\\\n', '<br />') | html %]</td> >@@ -601,6 +609,25 @@ > return true; > } > >+ /* Custom table search configuration: If a table row >+ has an "expired" class, hide it UNLESS the >+ show_expired checkbox is checked */ >+ $.fn.dataTable.ext.search.push( >+ function( settings, searchData, index, rowData, counter ) { >+ var table = settings.nTable.id; >+ var row = $(settings.aoData[index].nTr); >+ if( row.hasClass("date_past") && !$("#show_past_" + table ).prop("checked") ){ >+ return false; >+ } else { >+ return true; >+ } >+ } >+ ); >+ >+ // Create current date variable >+ var date = new Date(); >+ var datestring = date.toISOString().substring(0, 10); >+ > $(document).ready(function() { > $(".hint").hide(); > $("#days_of_week").hide(); >@@ -616,6 +643,24 @@ > var first_td = $(this).find('td').first(); > first_td.html(weekdays[first_td.html()]); > }); >+ $("#holidayweeklyrepeatable").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sDom": 't', >+ "bPaginate": false >+ })); >+ var tables = $("#holidaysyearlyrepeatable, #holidaysunique, #holidaysfloat").DataTable($.extend(true, {}, dataTablesDefaults, { >+ "sDom": 't', >+ "bPaginate": false, >+ "createdRow": function( row, data, dataIndex ) { >+ var holiday = $(row).data("date"); >+ if( holiday < datestring ){ >+ $(row).addClass("date_past"); >+ } >+ } >+ })); >+ >+ $(".show_past").on("change", function(){ >+ tables.draw(); >+ }); > > $("a.helptext").click(function () { > $(this).parent().find(".hint").toggle(); >diff --git a/tools/discrete_calendar.pl b/tools/discrete_calendar.pl >index f7c041520f..96dd7daa31 100755 >--- a/tools/discrete_calendar.pl >+++ b/tools/discrete_calendar.pl >@@ -146,9 +146,9 @@ my @week_days = $calendar->get_week_days_holidays(); > my @repeatable_holidays = $calendar->get_repeatable_holidays(); > > #discrete_calendar unique holidays >-my @unique_holidays =$calendar->get_unique_holidays(); >+my @unique_holidays =$calendar->get_unique_holidays(0); > #discrete_calendar floating holidays >-my @float_holidays =$calendar->get_float_holidays(); >+my @float_holidays =$calendar->get_float_holidays(0); > #discrete_caledar need validation holidays > my @need_validation_holidays =$calendar->get_need_validation_holidays(); > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17015
:
53859
|
54318
|
54419
|
59166
|
59167
|
59168
|
59169
|
59170
|
59171
|
59267
|
59268
|
59269
|
59270
|
59271
|
59463
|
59516
|
59517
|
59518
|
59519
|
59520
|
59561
|
59562
|
59586
|
59587
|
59888
|
59889
|
60902
|
60903
|
60904
|
60905
|
60906
|
60986
|
61737
|
62375
|
62376
|
62380
|
63257
|
63282
|
63362
|
63363
|
63364
|
63365
|
63366
|
63367
|
64235
|
65073
|
65074
|
65075
|
65076
|
65077
|
67721
|
67722
|
67723
|
67724
|
67725
|
67879
|
67929
|
67930
|
67931
|
67932
|
67933
|
67934
|
68392
|
68393
|
68394
|
68395
|
68396
|
68397
|
71634
|
71635
|
71636
|
71637
|
71638
|
72890
|
73145
|
74859
|
74860
|
74861
|
74862
|
74863
|
74864
|
74865
|
74866
|
75444
|
75479
|
76594
|
77249
|
77250
|
77607
|
77608
|
77609
|
77610
|
77611
|
77612
|
77613
|
77770
|
77771
|
77772
|
77773
|
77774
|
79035
|
80523
|
80524
|
80525
|
80526
|
80527
|
80528
|
80529
|
80530
|
80531
|
80532
|
80533
|
80534
|
80535
|
83547
|
85394
|
85677
|
85678
|
85679
|
85680
|
85681
|
85682
|
85683
|
85684
|
85685
|
85686
|
85687
|
85688
|
85689
|
85690
|
85691
|
92595
|
92596
|
92597
|
92598
|
100079
|
110383
|
110384
|
110386
|
110387
|
110388
|
110389
|
113541
|
113905
|
115501
|
115502
|
115503
|
115504
|
115505
|
115506
|
115507
|
115508
|
115509
|
115510
|
115511
|
118554
|
118555
|
118556
|
118557
|
118558
|
118559
|
119095
|
119097
|
119099
|
119100
|
119101
|
119102
|
131619
|
131620
|
131621
|
131622
|
131623
|
131624
|
131625
|
131626
|
131634
|
131635
|
131636
|
131637
|
131638
|
131639
|
131640
|
131641
|
131667
|
132199
|
133596
|
133597
|
133598
|
133599
|
133600
|
133601
|
133602
|
133603
|
133604
|
133605
|
133678
|
137219
|
137220
|
137221
|
137222
|
137223
|
137224
|
137225
|
137226
|
137227
|
137228
|
137229
|
139378
|
139379
|
139380
|
139381
|
139382
|
139599
|
139600
|
139601
|
139602
|
139603
|
139851
|
140150
|
141176
|
144257
|
144258
|
144259
|
144260
|
144261
|
144262
|
144264
|
144268
|
144269
|
144270
|
144271
|
144272
|
144273
|
151438
|
151439
|
151440
|
151441
|
151442
|
151443
|
151444
|
151445
|
151446
|
151447
|
151448
|
151449
|
151450
|
156340
|
156341
|
156342
|
156343
|
156344
|
156345
|
156346
|
156347
|
156348
|
156349
|
156350
|
156351
|
156352
|
156353
|
156354
|
156355
|
157656
|
157657
|
157658
|
157659
|
157660
|
157661
|
157662
|
157663
|
157664
|
157665
|
157666
|
157667
|
157668
|
157669
|
157670
|
157671
|
157672
|
167805
|
167806
|
167807
|
167808
|
167809