Bugzilla – Attachment 180974 Details for
Bug 39593
Show library hours in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39593: Show library hours in OPAC
Bug-39593-Show-library-hours-in-OPAC.patch (text/plain), 4.59 KB, created by
Biblibre Sandboxes
on 2025-04-15 15:14:03 UTC
(
hide
)
Description:
Bug 39593: Show library hours in OPAC
Filename:
MIME Type:
Creator:
Biblibre Sandboxes
Created:
2025-04-15 15:14:03 UTC
Size:
4.59 KB
patch
obsolete
>From 3e7da8cb108c4b2e5a05e4817624f6377d4d6a1b Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 10 Apr 2025 11:50:56 +0000 >Subject: [PATCH] Bug 39593: Show library hours in OPAC > >This patch adds library hours to the information display on the OPAC's >libraries page. > >To test, apply the patch and add hours to one or more libraries if >necessary (Administration -> Libraries). > >- In the OPAC, go to the Libraries page. >- The libraries you added hours for should show a table of days with > opening and closing times. >- If both opening and closing times on a day are empty the table shows > "Closed". >- Libraries without hours should not show the table of hours. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: Christopher <cbrannon@cdalibrary.org> >--- > .../bootstrap/en/modules/opac-library.tt | 68 +++++++++++++++++++ > 1 file changed, 68 insertions(+) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt >index 178b13922c..954db88620 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt >@@ -1,6 +1,7 @@ > [% USE raw %] > [% USE Asset %] > [% USE Koha %] >+[% USE KohaTimes %] > [% PROCESS 'display-library-address.inc' %] > [% USE AdditionalContents %] > [% IF library %][% SET OpacLibraryInfo = library.opac_info( lang => lang ) %][% END %] >@@ -33,6 +34,9 @@ > border: 0; > border-bottom: 1px solid rgba(0, 0, 0, 0.1); > } >+ .library_hours_table { >+ width: auto; >+ } > </style> > [% END %] > </head> >@@ -40,6 +44,24 @@ > [% INCLUDE 'bodytag.inc' bodyid='opac-library' bodyclass='scrollto' %] > [% INCLUDE 'masthead.inc' %] > >+[% BLOCK dayname %] >+ [% IF day == 0 %] >+ <span>Sunday</span> >+ [% ELSIF day == 1 %] >+ <span>Monday</span> >+ [% ELSIF day == 2 %] >+ <span>Tuesday</span> >+ [% ELSIF day == 3 %] >+ <span>Wednesday</span> >+ [% ELSIF day == 4 %] >+ <span>Thursday</span> >+ [% ELSIF day == 5 %] >+ <span>Friday</span> >+ [% ELSE %] >+ <span>Saturday</span> >+ [% END %] >+[% END %] >+ > [% BLOCK library_description %] > <div property="description"> [% IF OpacLibraryInfo %][% OpacLibraryInfo.content | $raw %][% END %] </div> > [% END %] >@@ -60,6 +82,52 @@ > <p class="branchurl"><a href="[% library.branchurl | url %]" property="url">[% library.branchurl | html %]</a></p> > [% END %] > [% END %] >+ >+ [% SET CalendarFirstDayOfWeek = Koha.Preference("CalendarFirstDayOfWeek") %] >+ [% SET set_hours = 0 %] >+ [% IF library.library_hours.count > 0 %] >+ [% FOR i IN [0..6] %] >+ [% IF library.library_hours.as_list.$i.open_time != null || library.library_hours.as_list.$i.close_time != null %] >+ [% set_hours = 1 %] >+ [% END %] >+ [% END %] >+ [% END %] >+ [% IF set_hours > 0 # Existing library %] >+ [% SET library_hours = library.library_hours.as_list %] >+ <div id="library_hours"> >+ <table id="[% library.branchcode | html %]_hours_table" class="table library_hours_table"> >+ <caption>Hours</caption> >+ <thead> >+ <tr> >+ <th> </th> >+ <th>Opening time</th> >+ <th>Closing time</th> >+ </tr> >+ </thead> >+ <tbody> >+ [% FOR i IN [0..6] %] >+ [% SET d = ( CalendarFirstDayOfWeek + i) % 7 %] >+ [% SET hr = library_hours.$d %] >+ <tr id="hours_[% d | html %]"> >+ <th scope="row"> >+ <span>[% PROCESS dayname day=d %]</span> >+ </th> >+ [% IF ( hr.open_time == null && hr.close_time == null ) %] >+ <td colspan="2">Closed</td> >+ [% ELSE %] >+ <td> >+ <span>[% IF hr.open_time != null %][% hr.open_time | $KohaTimes %][% END %]</span> >+ </td> >+ <td> >+ <span>[% IF hr.close_time != null %][% hr.close_time | $KohaTimes %][% END %]</span> >+ </td> >+ [% END %] >+ </tr> >+ [% END %] >+ </tbody> >+ </table> >+ </div> >+ [% END %] > [% END %] > > <div class="main"> >-- >2.39.5
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 39593
:
180765
|
180974
|
180976
|
181142