Bugzilla – Attachment 92495 Details for
Bug 7611
Show the NOT_LOAN authorised values for item status in XSLT OPAC search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7611: Show the NOT_LOAN authorised values for item status in XSLT OPAC search results
Bug-7611-Show-the-NOTLOAN-authorised-values-for-it.patch (text/plain), 5.53 KB, created by
Nick Clemens (kidclamp)
on 2019-08-29 13:54:17 UTC
(
hide
)
Description:
Bug 7611: Show the NOT_LOAN authorised values for item status in XSLT OPAC search results
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-08-29 13:54:17 UTC
Size:
5.53 KB
patch
obsolete
>From 18039bbb6fc829598059435cc8e72f624206e3a5 Mon Sep 17 00:00:00 2001 >From: Mehdi Hamidi <mehdi.hamidi@inlibro.com> >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. > >Patch sponsored by the CCSR ( http://www.ccsr.qc.ca ) >--- > C4/XSLT.pm | 10 +++++++++- > .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 22 ++++++++++++++++++++++ > 2 files changed, 31 insertions(+), 1 deletion(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 648bab28ab..4574f5f917 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -309,9 +309,11 @@ sub buildKohaItemsNamespace { > my $location = ""; > my $ccode = ""; > 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 = ''; > my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber}); > > my $reservestatus = C4::Reserves::GetReserveStatus( $item->{itemnumber} ); >@@ -324,6 +326,11 @@ sub buildKohaItemsNamespace { > if ( $item->{itemnotforloan} && $item->{itemnotforloan} > 0 || $item->{notforloan} && $item->{notforloan} > 0 || $item->{itype} && $itemtypes->{ $item->{itype} }->{notforloan} && $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) { > $status = "reference"; > } >+ if ($item->{itemnotforloan} > 0 || $item->{notforloan} > 0 ){ >+ $status = "reallynotforloan"; >+ $substatus = $descs{$item->{notforloan}} || ''; >+ $substatus = $substatus->{opac_description} if $substatus; >+ } > if ($item->{onloan}) { > $status = "Checked out"; > } >@@ -361,6 +368,7 @@ sub buildKohaItemsNamespace { > . "<location>$location</location>" > . "<ccode>$ccode</ccode>" > . "<status>".( $status // q{} )."</status>" >+ . "<substatus>$substatus</substatus>" > . "<itemcallnumber>$itemcallnumber</itemcallnumber>" > . "<stocknumber>$stocknumber</stocknumber>" > . "</item>"; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index 6aaa329870..185598ca84 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 @@ > <xsl:key name="item-by-status" match="items:item" use="items:status"/> > <xsl:key name="item-by-status-and-branch-home" match="items:item" use="concat(items:status, ' ', items:homebranch)"/> > <xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/> >+ <xsl:key name="item-by-substatus-and-branch" match="items:item" use="concat(items:substatus, ' ', items:homebranch)"/> > > <xsl:template match="/"> > <xsl:apply-templates/> >@@ -1332,6 +1333,27 @@ > </xsl:when></xsl:choose> > </xsl:when> </xsl:choose> > >+ <xsl:if test="count(key('item-by-status', 'available'))=0"> >+ <span class="available"><xsl:value-of select="items:homebranch"/><xsl:text>: </xsl:text></span> >+ </xsl:if> >+ >+ <xsl:choose> >+ <xsl:when test="count(key('item-by-status', 'reallynotforloan'))>0"> >+ <span class="unavailable"> >+ <br /> >+ <xsl:variable name="reference_items" select="key('item-by-status', 'reallynotforloan')"/> >+ <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]"> >+ <xsl:value-of select="items:substatus"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<span class="LabelCallNumber">Call number: </span><xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ </xsl:for-each> >+ </span> >+ </xsl:when> >+ </xsl:choose> >+ > <xsl:if test="count(key('item-by-status', 'Checked out'))>0"> > <span class="unavailable"> > <xsl:text>Checked out (</xsl:text> >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7611
:
7905
|
7906
|
7907
|
60816
|
62930
|
62931
|
85115
|
92495
|
92496
|
94026
|
94212
|
95060
|
95061
|
95235
|
95236
|
95237
|
95238
|
95239
|
95240
|
97804
|
97805
|
97806
|
97807
|
97808
|
99074
|
99075
|
99076
|
99077
|
99078
|
99163