Bugzilla – Attachment 122462 Details for
Bug 26302
OPAC XSLT Results: List variable number of itemcallnumbers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26302: OPAC XSLT Results: List variable number of itemcallnumbers
Bug-26302-OPAC-XSLT-Results-List-variable-number-o.patch (text/plain), 9.41 KB, created by
David Nind
on 2021-06-26 23:17:54 UTC
(
hide
)
Description:
Bug 26302: OPAC XSLT Results: List variable number of itemcallnumbers
Filename:
MIME Type:
Creator:
David Nind
Created:
2021-06-26 23:17:54 UTC
Size:
9.41 KB
patch
obsolete
>From 98b654dc563027350246d9602580a52ccd0e9b26 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 26 Aug 2020 13:49:53 +0000 >Subject: [PATCH] Bug 26302: OPAC XSLT Results: List variable number of > itemcallnumbers > >We define a local preference resultsMaxItems and add it to the xml >passed to the results XSLT (in C4::XSLT). >Instead of showing one item, we add this number of items for the >available for loan and reference segments. > >Test plan: >Play with the value of local pref resultsMaxItems. >Check if it matches with displayed callnumbers. >Try home and holdingbranch for results location. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: David Nind <david@davidnind.com> >--- > C4/XSLT.pm | 2 + > .../en/xslt/MARC21slim2OPACResults.xsl | 41 +++++++++++++++---- > 2 files changed, 35 insertions(+), 8 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index 3cdf451b28..77e56077f1 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -173,9 +173,11 @@ sub get_xslt_sysprefs { > TrackClicks opacthemes IdRef OpacSuppression > OPACResultsLibrary OPACShowOpenURL > OpenURLResolverURL OpenURLImageLocation >+ resultsMaxItems > OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts / ) > { > my $sp = C4::Context->preference( $syspref ); >+ $sp ||= 1 if $syspref eq 'resultsMaxItems'; # needs default > next unless defined($sp); > $sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n"; > } >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index 92d1d2ff8f..b496ca9f53 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -39,6 +39,7 @@ > <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/> > <xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/> > <xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/> >+ <xsl:variable name="resultsMaxItems" select="marc:sysprefs/marc:syspref[@name='resultsMaxItems']"/> > <xsl:variable name="leader" select="marc:leader"/> > <xsl:variable name="leader6" select="substring($leader,7,1)"/> > <xsl:variable name="leader7" select="substring($leader,8,1)"/> >@@ -1282,7 +1283,13 @@ > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> > <span class="CallNumberAndLabel"> > <span class="LabelCallNumber">Call number: </span> >- <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> >+ <span class="CallNumber"> >+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> >+ <xsl:value-of select="items:itemcallnumber"/> >+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> >+ </xsl:for-each> >+ <xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> >+ </span> > </span> > </xsl:if> > <xsl:choose> >@@ -1302,10 +1309,16 @@ > <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/> > <xsl:text>) </xsl:text> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> >- <span class="CallNumberAndLabel"> >+ <span class="CallNumberAndLabel"> > <span class="LabelCallNumber">Call number: </span> >- <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> >- </span> >+ <span class="CallNumber"> >+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> >+ <xsl:value-of select="items:itemcallnumber"/> >+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> >+ </xsl:for-each> >+ <xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> >+ </span> >+ </span> > </xsl:if> > <xsl:choose> > <xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when> >@@ -1322,10 +1335,16 @@ > <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/> > <xsl:text>) </xsl:text> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> >- <span class="CallNumberAndLabel"> >+ <span class="CallNumberAndLabel"> > <span class="LabelCallNumber">Call number: </span> >- <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> >- </span> >+ <span class="CallNumber"> >+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> >+ <xsl:value-of select="items:itemcallnumber"/> >+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> >+ </xsl:for-each> >+ <xsl:if test="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> >+ </span> >+ </span> > </xsl:if> > <xsl:choose> > <xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when> >@@ -1362,7 +1381,13 @@ > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> > <span class="CallNumberAndLabel"> > <span class="LabelCallNumber">Call number: </span> >- <span class="CallNumber"><xsl:value-of select="items:itemcallnumber"/><xsl:if test="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))>1"><xsl:text>, ..</xsl:text></xsl:if></span> >+ <span class="CallNumber"> >+ <xsl:for-each select="$reference_items[position() <= $resultsMaxItems]"> >+ <xsl:value-of select="items:itemcallnumber"/> >+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> >+ </xsl:for-each> >+ <xsl:if test="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> >+ </span> > </span> > </xsl:if> > <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >-- >2.20.1
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 26302
:
109184
|
119108
|
119109
|
119110
|
119111
|
122386
|
122387
|
122388
|
122389
|
122391
|
122462
|
122463
|
122464
|
122465
|
122466
|
122487
|
123499
|
123500
|
123501
|
123502
|
123526
|
123527
|
123528
|
123529
|
123531
|
123532
|
123533
|
123534
|
123640
|
123641
|
123643
|
123644
|
123645
|
123646
|
123647
|
123648
|
123649
|
124243
|
124244
|
124245