From c324330221f78de0d5dfb974da0e6e8e414c2a8d 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 | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 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 5d1a3dc709b..e3d9c6433b9 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 ) %] @@ -35,13 +35,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 --> @@ -90,23 +84,23 @@ [% END %] [% 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 %] + <hr /> + <div class="library_description" property="description"> + [% PROCESS koha_news_block news => OpacLibraryInfo %] </div> [% END %] </div> </div> - </div> <!-- /#library_info --> + </div> <!-- /#library_details --> [% ELSE %] - <div id="library_info" class="maincontent"> + <div id="library_details" class="maincontent"> <h1>Libraries</h1> [% FOREACH library IN libraries %] [% IF ( branchcode == library.branchcode ) %] @@ -119,10 +113,10 @@ [% library.branchname | html %] </a> </h2> - [% PROCESS library_info %] + [% PROCESS library_details %] </div> [% END %] - </div> <!-- /#library_info --> + </div> <!-- /#library_details --> [% END # /IF library %] </div> <!-- /.col --> -- 2.39.5