From a9f7dec7da77b85162ae917ed37cabf54d0b0e84 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 28 Nov 2016 11:02:25 +0100 Subject: [PATCH] Bug 17624: Separate XSLT item status for Staff Collection Content-Type: text/plain; charset=utf-8 In order to differentiate a regular not for loan with a not-for-loan that has the status "Staff Collection", this patch slightly adjusts the status in C4::XSLT::buildKohaItemsNamespace. This status is used in the OPAC results XSLT. If you do not have items with notforloan>=2, there will be no change in behavior. If you use notforloan=2 and did not change its authorised value description, a count for Staff Collection will be added in the Availability line. The items with notforloan==2 will no longer be viewed as "for reference". Higher values for notforloan will no longer be listed too as "for reference". (Same for a modified notforloan==2.) Note: I also considered using a plugin here or a specific preference. This solution is by far the simplest. Currently, we are presenting the item status in various places on various ways. A better solution would depend on consolidating the item status code in Koha::Item. Test plan: [1] Pick a biblio with three items: one should be for loan, set the other two to Not for loan and Staff Collection. [2] Look for this biblio on OPAC search results. Check Availability. --- C4/XSLT.pm | 11 +++++++++++ .../opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index a829402..99982bb 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -299,6 +299,17 @@ sub buildKohaItemsNamespace { if ( $item->{itemnotforloan} > 0 || $item->{notforloan} > 0 || $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) { $status = "reference"; } + if( $item->{notforloan} > 1 ) { + # Handle higher positive values for notforloan + # If av [exceptionally] returns nothing, we'll keep reference + my $av = Koha::AuthorisedValues->search({ + category => 'NOT_LOAN', + authorised_value => $item->{notforloan}, + }); + if( $av->count ) { + $status = $av->next->opac_description; + } + } if ($item->{onloan}) { $status = "Checked out"; } diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index 353b08e..61828e0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -1159,7 +1159,7 @@ () - No items available + No items available. @@ -1249,6 +1249,13 @@ + + + Staff Collection ( + + ). + + Checked out ( -- 2.1.4