From 90153a7a9884390d6b4bcbed708940fec00ce29f Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 8 Mar 2024 11:29:19 +0100 Subject: [PATCH] Bug 36281: Display restricted info only if item is not restricted (OPAC details) If you define a description for restricted = 0 : In OPAC details, restricted info is displayed even if item is not restricted (value 0). This patch fixes by adding 'IF item.restricted'. Also creates a BLOCK to avoid code duplication. Also adds span around status text to create easier translation. Test plan : 1) Create a description in restricted autorised values category for value 0 2) Create a description in restricted autorised values category for value 1 3) Edit an biblio record to add an item with restricted=0 and an item with restricted=1 4) Display this biblio on OPAC details page => Check you see resticted info only for restricted item Signed-off-by: Lucas Gass Signed-off-by: Nick Clemens --- .../bootstrap/en/includes/item-status.inc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc index 2d19d918cea..f98cf180eb5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -90,19 +90,26 @@ [% END %] [% END %] +[% BLOCK restricted_info %] + [% IF item.restricted %] + [% SET restricted_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted, opac => 1 ) %] + [% IF restricted_lib %] + ([% restricted_lib | html %]) + [% END %] + [% END %] +[% END %] -[% SET restricted_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted, opac => 1 ) %] [% IF item.notforloan %] [% SET itemavailable = 0 %] [% notforloan_lib = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan, opac => 1 ) %] [% IF notforloan_lib %] - [% notforloan_lib | html %] [% IF restricted_lib %]([% restricted_lib | html %])[% END %] + [% notforloan_lib | html %] [% PROCESS restricted_info %] [% ELSE %] - Not for loan [% IF restricted_lib %]([% restricted_lib | html %])[% END %] + Not for loan [% PROCESS restricted_info %] [% END %] [% ELSIF item.itemtype.notforloan %] [% SET itemavailable = 0 %] - Not for loan [% IF restricted_lib %]([% restricted_lib | html %])[% END %] + Not for loan [% PROCESS restricted_info %] [% END %] [% IF ( item.bundle_host ) %] @@ -135,5 +142,5 @@ [% END %] [% IF ( itemavailable ) %] - Available [% IF restricted_lib %]([% restricted_lib | html %])[% END %] + Available [% PROCESS restricted_info %] [% END %] -- 2.30.2