From d8159b61f592774696c25338878c49c77718318f Mon Sep 17 00:00:00 2001 From: Mehdi Hamidi Date: Fri, 3 Mar 2017 14:33:29 -0500 Subject: [PATCH] Bug 7611: Show the NOT_LOAN authorised values for item status in XSLT OPAC search results Added : Call number for all not for loan status XSLT Results template improvement : Use the NOT_LOAN authorised values Improvement : Use the NOT_LOAN authorised values when showing items status in the OPAC search results. Before this patch, these items were only considered as "unavailable". Note : This patch only affects the OPAC XSLT search results template for MARC21 records. This patch was not tested on UNIMARC or NORMARC records. I won't be able to support these formats, so I'm hoping someone could do the same for these other record formats. Sponsored-by: CCSR ( http://www.ccsr.qc.ca ) Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- C4/XSLT.pm | 10 +++++++++ .../en/xslt/MARC21slim2OPACResults.xsl | 22 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 37023cda40..0c35a5e585 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -315,8 +315,12 @@ sub buildKohaItemsNamespace { my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search->unblessed } }; my $xml = ''; + my %descs = map { $_->{authorised_value} => $_ } Koha::AuthorisedValues->get_descriptions_by_koha_field( { kohafield => 'items.notforloan' } ); + for my $item (@items) { my $status; + my $substatus = ''; +<<<<<<< HEAD if ($item->has_pending_hold) { $status = 'Pending hold'; @@ -339,6 +343,11 @@ sub buildKohaItemsNamespace { elsif ($item->onloan) { $status = "Checked out"; } + elsif ( $item->notforloan > 0 ) { + $status = "reallynotforloan"; + $substatus = $descs{$item->{notforloan}} || ''; + $substatus = $substatus->{opac_description} if $substatus; + } elsif ( $item->notforloan && $item->notforloan > 0 || exists $itemtypes->{ $item->effective_itemtype } && $itemtypes->{ $item->effective_itemtype }->{notforloan} == 1 ) @@ -364,6 +373,7 @@ sub buildKohaItemsNamespace { . "$location" . "$ccode" . "".( $status // q{} )."" + . "$substatus" . "$itemcallnumber" . "$stocknumber" . ""; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index 14f8b17144..c4061cda99 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -12,6 +12,7 @@ + @@ -1334,6 +1335,27 @@ + + : + + + + + +
+ + + + [Call number: ] + ( + + ) + . , + +
+
+
+ Checked out ( -- 2.39.5