Line 0
Link Here
|
|
|
1 |
From 569a125952166d289abf7c7c6b82205d30dd7dd2 Mon Sep 17 00:00:00 2001 |
2 |
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> |
3 |
Date: Wed, 26 Aug 2020 13:49:53 +0000 |
4 |
Subject: [PATCH 1/3] Bug 26302: OPAC XSLT Results: List variable number of |
5 |
itemcallnumbers |
6 |
Content-Type: text/plain; charset=utf-8 |
7 |
|
8 |
We define a local preference resultsMaxItems and add it to the xml |
9 |
passed to the results XSLT (in C4::XSLT). |
10 |
Instead of showing one item, we add this number of items for the |
11 |
available for loan and reference segments. |
12 |
|
13 |
Test plan: |
14 |
Play with the value of local pref resultsMaxItems. |
15 |
Check if it matches with displayed callnumbers. |
16 |
Try home and holdingbranch for results location. |
17 |
|
18 |
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> |
19 |
--- |
20 |
C4/XSLT.pm | 2 ++ |
21 |
.../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 41 +++++++++++++++++----- |
22 |
2 files changed, 35 insertions(+), 8 deletions(-) |
23 |
|
24 |
diff --git a/C4/XSLT.pm b/C4/XSLT.pm |
25 |
index cd183fbe51..c32368d622 100644 |
26 |
--- a/C4/XSLT.pm |
27 |
+++ b/C4/XSLT.pm |
28 |
@@ -173,9 +173,11 @@ sub get_xslt_sysprefs { |
29 |
TrackClicks opacthemes IdRef OpacSuppression |
30 |
OPACResultsLibrary OPACShowOpenURL |
31 |
OpenURLResolverURL OpenURLImageLocation |
32 |
+ resultsMaxItems |
33 |
OpenURLText OPACShowMusicalInscripts OPACPlayMusicalInscripts / ) |
34 |
{ |
35 |
my $sp = C4::Context->preference( $syspref ); |
36 |
+ $sp ||= 1 if $syspref eq 'resultsMaxItems'; # needs default |
37 |
next unless defined($sp); |
38 |
$sysxml .= "<syspref name=\"$syspref\">$sp</syspref>\n"; |
39 |
} |
40 |
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl |
41 |
index d7f299e226..7a0065fef1 100644 |
42 |
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl |
43 |
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl |
44 |
@@ -39,6 +39,7 @@ |
45 |
<xsl:variable name="singleBranchMode" select="1"/> |
46 |
<xsl:variable name="OPACTrackClicks" select="marc:sysprefs/marc:syspref[@name='TrackClicks']"/> |
47 |
<xsl:variable name="BiblioDefaultView" select="marc:sysprefs/marc:syspref[@name='BiblioDefaultView']"/> |
48 |
+ <xsl:variable name="resultsMaxItems" select="marc:sysprefs/marc:syspref[@name='resultsMaxItems']"/> |
49 |
<xsl:variable name="leader" select="marc:leader"/> |
50 |
<xsl:variable name="leader6" select="substring($leader,7,1)"/> |
51 |
<xsl:variable name="leader7" select="substring($leader,8,1)"/> |
52 |
@@ -1282,7 +1283,13 @@ |
53 |
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> |
54 |
<span class="CallNumberAndLabel"> |
55 |
<span class="LabelCallNumber">Call number: </span> |
56 |
- <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> |
57 |
+ <span class="CallNumber"> |
58 |
+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> |
59 |
+ <xsl:value-of select="items:itemcallnumber"/> |
60 |
+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> |
61 |
+ </xsl:for-each> |
62 |
+ <xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> |
63 |
+ </span> |
64 |
</span> |
65 |
</xsl:if> |
66 |
<xsl:choose> |
67 |
@@ -1302,10 +1309,16 @@ |
68 |
<xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/> |
69 |
<xsl:text>) </xsl:text> |
70 |
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> |
71 |
- <span class="CallNumberAndLabel"> |
72 |
+ <span class="CallNumberAndLabel"> |
73 |
<span class="LabelCallNumber">Call number: </span> |
74 |
- <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> |
75 |
- </span> |
76 |
+ <span class="CallNumber"> |
77 |
+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> |
78 |
+ <xsl:value-of select="items:itemcallnumber"/> |
79 |
+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> |
80 |
+ </xsl:for-each> |
81 |
+ <xsl:if test="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> |
82 |
+ </span> |
83 |
+ </span> |
84 |
</xsl:if> |
85 |
<xsl:choose> |
86 |
<xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when> |
87 |
@@ -1322,10 +1335,16 @@ |
88 |
<xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/> |
89 |
<xsl:text>) </xsl:text> |
90 |
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> |
91 |
- <span class="CallNumberAndLabel"> |
92 |
+ <span class="CallNumberAndLabel"> |
93 |
<span class="LabelCallNumber">Call number: </span> |
94 |
- <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> |
95 |
- </span> |
96 |
+ <span class="CallNumber"> |
97 |
+ <xsl:for-each select="$available_items[position() <= $resultsMaxItems]"> |
98 |
+ <xsl:value-of select="items:itemcallnumber"/> |
99 |
+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> |
100 |
+ </xsl:for-each> |
101 |
+ <xsl:if test="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> |
102 |
+ </span> |
103 |
+ </span> |
104 |
</xsl:if> |
105 |
<xsl:choose> |
106 |
<xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when> |
107 |
@@ -1362,7 +1381,13 @@ |
108 |
<xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> |
109 |
<span class="CallNumberAndLabel"> |
110 |
<span class="LabelCallNumber">Call number: </span> |
111 |
- <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> |
112 |
+ <span class="CallNumber"> |
113 |
+ <xsl:for-each select="$reference_items[position() <= $resultsMaxItems]"> |
114 |
+ <xsl:value-of select="items:itemcallnumber"/> |
115 |
+ <xsl:if test="position()!=last()"><xsl:text>, </xsl:text></xsl:if> |
116 |
+ </xsl:for-each> |
117 |
+ <xsl:if test="count(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch)))>$resultsMaxItems"><xsl:text>, ..</xsl:text></xsl:if> |
118 |
+ </span> |
119 |
</span> |
120 |
</xsl:if> |
121 |
<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> |
122 |
-- |
123 |
2.11.0 |
124 |
|