From 3c90f7ca79554a2389f6cfd401ec8b575a0845b1 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 31 Jan 2025 13:30:45 +0000 Subject: [PATCH] Bug 38982: OpacLibraryInfo should respect news expiration date This patch updates the library detail view in the OPAC so that the OpacLibraryInfo HTML customization respects the content block's expiration date. The patch also changes the "library_info" BLOCK to "library_details" to avoid confusion. To test, apply the patch and enable the OPACShowLibraries system preference if necessary. - Create an OpacLibraryInfo HTML customization if necessary: - In the staff client, go to Tools -> HTML customizations - Create a new entry in the display location "OpacLibraryInfo" - Create the entry with a publication date but no expiration date. - In the OPAC, go to the "Libraries" page. - View the details of a library you created OpacLibraryInfo for. - Confirm that the content appears. - Return to the staff interface and edit the entry, adding an expiration date in the past. - In the OPAC, confirm that the content no longer appears. Sponsored-by: Athens County Public Libraries --- .../bootstrap/en/modules/opac-library.tt | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) 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 5eb981e67c6..425c846bb35 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-library.tt @@ -3,9 +3,9 @@ [% USE Koha %] [% PROCESS 'display-library-address.inc' %] [% USE AdditionalContents %] -[% IF library %][% SET OpacLibraryInfo = library.opac_info( lang => lang ) %][% END %] [% SET OpacNav = AdditionalContents.get( location => "OpacNav", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] [% SET OpacNavBottom = AdditionalContents.get( location => "OpacNavBottom", lang => lang, library => logged_in_user.branchcode || default_branch, blocktitle => 0 ) %] +[% SET OpacLibraryInfo = AdditionalContents.get( location => "OpacLibraryInfo", lang => lang, library => library.branchcode, blocktitle => 0 ) %] [% INCLUDE 'doc-head-open.inc' %] [% IF ( library ) %] @@ -36,11 +36,7 @@ [% INCLUDE 'bodytag.inc' bodyid='opac-library' bodyclass='scrollto' %] [% INCLUDE 'masthead.inc' %] -[% BLOCK library_description %] - <div property="description"> [% IF OpacLibraryInfo %][% OpacLibraryInfo.content | $raw %][% END %] </div> -[% END %] - -[% BLOCK library_info %] +[% BLOCK library_details %] <div class="branchaddress" property="address" typeof="PostalAddress"> [% PROCESS 'display-library-address' %] </div> <!-- /div property=address --> [% IF ( library.branchphone ) %] @@ -86,23 +82,21 @@ <div class="[% column_class | html %]"> [% IF ( library ) %] - <div id="library_info" class="maincontent" vocab="http://schema.org/" typeof="Library"> + <div id="library_details" class="maincontent" vocab="http://schema.org/" typeof="Library"> <h1 property="name">[% library.branchname | html %]</h1> <div class="row"> <div class="col-lg-8"> - [% PROCESS library_info %] + [% PROCESS library_details %] [% IF ( OpacLibraryInfo ) %] - <div class="library_description"> - <hr /> - [% PROCESS library_description %] - </div> + <hr /> + <div class="library_description" property="description"> [% PROCESS koha_news_block news => OpacLibraryInfo %] </div> [% END %] </div> </div> </div> - <!-- /#library_info --> + <!-- /#library_details --> [% ELSE %] - <div id="library_info" class="maincontent"> + <div id="library_details" class="maincontent"> <h1>Libraries</h1> [% SET div_class = "section_library" %] [% FOREACH library IN libraries %] @@ -113,11 +107,11 @@ <h2 property="name"> <a href="/cgi-bin/koha/opac-library.pl?branchcode=[% library.branchcode | url %]"> [% library.branchname | html %] </a> </h2> - [% PROCESS library_info %] + [% PROCESS library_details %] </div> [% END %] </div> - <!-- /#library_info --> + <!-- /#library_details --> [% END # /IF library %] </div> <!-- /.col --> -- 2.39.5