From 3e3339475747ea8e61f475904bb4a99674b1f0e5 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Fri, 4 Jan 2019 10:11:03 +0000 Subject: [PATCH] Bug 10676: Fix behaviour of OpacHiddenItems for items.restricted The numerical restricted value was overwritten in GetItemsInfo with the description. So OpacHiddenItems would only work for restricted using the description, not the numerical value of the authorised value like for other similar status fields. This changes GetItemsInfo to use a separate variable for the description, as it's already done for notforloan and changes the template files where the variable is used accordingly. To test - Before applying patch - Configure OpacHiddenItems with: restricted: [1] - Find a record with more than one item and mark one of the items as "Restricted Access" (assume standard sample data - check authorised value if status doesn't exist) - Verify the item is still shown in OPAC. - Apply patch - Verify that the item is now hidden - Verify that the status still displays nicely in the staff detail page - Delete OpacHiddenItems - Verify that the status is showing nicely in the OPAC detail page Signed-off-by: Pierre-Marc Thibault Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 39d2885d1330afe825e1881f5fc8033d459f6006) Signed-off-by: Martin Renvoize (cherry picked from commit ceb74447df18d1fc8dc05b6142a10085d3a67420) Signed-off-by: Lucas Gass --- C4/Items.pm | 4 ++-- .../intranet-tmpl/prog/en/modules/catalogue/detail.tt | 2 +- .../opac-tmpl/bootstrap/en/includes/item-status.inc | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 8c1ee99fd5..7a8db6742a 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1103,8 +1103,8 @@ sub GetItemsInfo { # get restricted status and description if applicable $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.restricted', authorised_value => $data->{restricted} }); - $data->{restricted} = $descriptions->{lib} // ''; - $data->{restrictedopac} = $descriptions->{opac_description} // ''; + $data->{restrictedvalue} = $descriptions->{lib} // ''; + $data->{restrictedvalueopac} = $descriptions->{opac_description} // ''; # my stack procedures $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => $data->{frameworkcode}, kohafield => 'items.stack', authorised_value => $data->{stack} }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 5a72fe46b6..0112406405 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -457,7 +457,7 @@ [% END %] [% IF ( item.restricted ) %] - ([% item.restricted %]) + ([% item.restrictedvalue | html %]) [% END %] 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 7fd4fd2869..9c368daf57 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc @@ -65,13 +65,13 @@ [% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %] [% SET itemavailable = 0 %] [% IF ( item.notforloanvalueopac ) %] - [% item.notforloanvalueopac %] [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] + [% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] [% ELSE %] - Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] + Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] [% END %] [% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %] [% SET itemavailable = 0 %] - Not for loan [% IF ( item.restrictedopac ) %]([% item.restrictedopac %])[% END %] + Not for loan [% IF ( item.restrictedvalueopac ) %]([% item.restrictedvalueopac | html %])[% END %] [% END %] [% IF ( item.damaged ) %] @@ -90,6 +90,6 @@ [% END %] [% IF ( itemavailable ) %] - [% IF NOT item.isa('Koha::Item') %][% SET restrictedopac = item.restrictedopac %][% END %] - Available [% IF restrictedopac %]([% restrictedopac %])[% END %] + [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %] + Available [% IF restrictedvalueopac %]([% restrictedvalueopac | html %])[% END %] [% END %] -- 2.39.5