From b3a5862462c12f0d2b9deee2a74085f8c99ef8a5 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 27 Jul 2021 21:34:32 +0000 Subject: [PATCH] Bug 28761: better handle notforloan and restricted status in item.status.inc To test: 1. create a course in course reserves, add an item to it. 2. confirm your item shows Available for its status on opac-course-details.pl 3. give your item a notforloan status 4. reload opac-course-details.pl, confirm its still "available" 5. give your item a restricted user status 6. reload opac-course-details.pl, confirm its still "available" 7. give your item a lost, damaged, or withdrawn status 8. reload opac-course-details.pl, these statuses *are* reflected 9. apply patch 10. check notforloan and restricted, they should be reflect the correct status now --- .../bootstrap/en/includes/item-status.inc | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 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 cd04f9f4a5..7cf23f1621 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -62,17 +62,14 @@ [% END %] [% END %] - -[% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %] +[% IF ( item.notforloan ) %] [% SET itemavailable = 0 %] - [% IF ( item.notforloanvalueopac ) %] - [% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] + [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %] + [% IF av_lib_include %] + [% av_lib_include | html %] [% ELSE %] - Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] + Not for loan [% END %] -[% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %] - [% SET itemavailable = 0 %] - Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] [% END %] [% IF ( item.damaged ) %] @@ -85,6 +82,16 @@ [% END %] [% END %] +[% IF (item.restricted ) %] + [% SET itemavailable = 0 %] + [% av_lib_include = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted, opac => 1 ) %] + [% IF av_lib_include %] + [% av_lib_include | html %] + [% ELSE %] + Item restricted + [% END %] +[% END %] + [% IF NOT ( item.isa('Koha::Item') ) AND item.on_order %][%# on_order is only set from opac-detail.pl %] [% SET itemavailable = 0 %] On order @@ -96,6 +103,5 @@ [% END %] [% IF ( itemavailable ) %] - [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %] - Available [% IF restrictedvalueopac %]([% restrictedvalueopac | html %])[% END %] + Available [% END %] -- 2.20.1