Bug 10676: Fix behaviour of OpacHiddenItems for items.restricted
authorKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 4 Jan 2019 10:11:03 +0000 (10:11 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Tue, 5 Mar 2019 15:56:20 +0000 (15:56 +0000)
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 <pierre-marc.thibault@inLibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 39d2885d1330afe825e1881f5fc8033d459f6006)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit ceb74447df18d1fc8dc05b6142a10085d3a67420)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

C4/Items.pm
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/item-status.inc

index 8c1ee99..7a8db67 100644 (file)
@@ -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} });
index 5a72fe4..0112406 100644 (file)
                         [% END %]
 
                         [% IF ( item.restricted ) %]
-                            <span class="restricted">([% item.restricted %])</span>
+                            <span class="restricted">([% item.restrictedvalue | html %])</span>
                         [% END %]
 
                     </td>
index 7fd4fd2..9c368da 100644 (file)
 [% IF NOT ( item.isa('Koha::Item') ) AND item.itemnotforloan %]
     [% SET itemavailable = 0 %]
     [% IF ( item.notforloanvalueopac ) %]
-        <span class="item-status notforloan">[% item.notforloanvalueopac %] [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
+        <span class="item-status notforloan">[% item.notforloanvalueopac | html %] [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
     [% ELSE %]
-        <span class="item-status notforloan">Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
+        <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
     [% END %]
 [% ELSIF NOT ( item.isa('Koha::Item') ) AND item.notforloan_per_itemtype %]
     [% SET itemavailable = 0 %]
-    <span class="item-status notforloan">Not for loan [% IF ( item.restrictedopac ) %]<span class="restricted">([% item.restrictedopac %])</span>[% END %]</span>
+    <span class="item-status notforloan">Not for loan [% IF ( item.restrictedvalueopac ) %]<span class="restricted">([% item.restrictedvalueopac | html %])</span>[% END %]</span>
 [% END %]
 
 [% IF ( item.damaged ) %]
@@ -90,6 +90,6 @@
 [% END %]
 
 [% IF ( itemavailable ) %]
-    [% IF NOT item.isa('Koha::Item') %][% SET restrictedopac = item.restrictedopac %][% END %]
-    <span class="item-status available">Available [% IF restrictedopac %]<span class="restricted">([% restrictedopac %])</span>[% END %]</span>
+    [% IF NOT item.isa('Koha::Item') %][% SET restrictedvalueopac = item.restrictedvalueopac %][% END %]
+    <span class="item-status available">Available [% IF restrictedvalueopac %]<span class="restricted">([% restrictedvalueopac | html %])</span>[% END %]</span>
 [% END %]