From 93ffb960b56f726b9af06ab89a6477482de400b6 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 11. restricted status should NOT cause the item to become unavailable 11. The item-status.inc also effects opac-detail and opac-cart 12. look at those and make sure everything looks correct and statuses are properly reflected --- .../bootstrap/en/includes/item-status.inc | 25 +++++++++++-------- 1 file changed, 15 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..19853287a7 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 ) %] @@ -96,6 +93,14 @@ [% END %] [% IF ( itemavailable ) %] - [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %] - Available [% IF restrictedvalueopac %]([% restrictedvalueopac | html %])[% END %] + Available +[% END %] + +[% IF (item.restricted ) %] + [% 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 %] -- 2.20.1