Bugzilla – Attachment 115267 Details for
Bug 21260
Improve the Availability line of OPAC XSLT search results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21260: Create three main XSLT Availability segments
Bug-21260-Create-three-main-XSLT-Availability-segm.patch (text/plain), 12.62 KB, created by
Ava
on 2021-01-19 01:13:56 UTC
(
hide
)
Description:
Bug 21260: Create three main XSLT Availability segments
Filename:
MIME Type:
Creator:
Ava
Created:
2021-01-19 01:13:56 UTC
Size:
12.62 KB
patch
obsolete
>From c743e35087ca8d41e849a14b01754700a058fd48 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 19 Aug 2020 16:52:13 +0200 >Subject: [PATCH] Bug 21260: Create three main XSLT Availability segments > >XSLT changes: >[1] Add an item count at the start. Also add variables for counting > status available and reference. Use these vars in the corresponding > 'blocks'. >[2] Refine the No items-test with the new itemcount. >[3] Combine the reallynotforloan block with the other statuses by > refining (extending) its initial test. All if's are moved up into > the former block but are unchanged. > >Result of these changes makes that the Availability line consists of three >segments: 1 Available items, 2 Reference items, 3 Other statuses. > >Test plan: >[1] Check a biblio without any items in the OAPC results. You should > see the No items only here. >[2] Check a biblio with one item checked out. You should see only the > 'third' segment with Checked out(1). >[3] Check a biblio with one available and a notforloan==1. You should > see segment 1 and 2. Both listing item call numbers. >[4] Check a biblio with one available and a notforloan==-1. You should > see segment 1 and 3. Both listing item call numbers. (See also the > following patch.) > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >Signed-off-by: ava li <rubyli208@gmail.com> >--- > .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 128 ++++++++++++--------- > 1 file changed, 71 insertions(+), 57 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >index f503addcfc..3ac4e6ece8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl >@@ -19,6 +19,8 @@ > </xsl:template> > <xsl:template match="marc:record"> > >+ <xsl:variable name="itemcount" select="count(items:items/items:item)"/> >+ > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> > <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/> > >@@ -1235,8 +1237,11 @@ > <!-- Availability line --> > <span class="results_summary availability"> > <span class="label">Availability: </span> >+ <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/> >+ <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/> >+ > <xsl:choose> >- <xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0 and count(key('item-by-status', 'reallynotforloan'))=0"> >+ <xsl:when test="$itemcount=0"> > <xsl:choose> > <xsl:when test="string-length($AlternateHoldingsField)=3 and marc:datafield[@tag=$AlternateHoldingsField]"> > <xsl:variable name="AlternateHoldingsCount" select="count(marc:datafield[@tag=$AlternateHoldingsField])"/> >@@ -1251,7 +1256,7 @@ > <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise> > </xsl:choose> > </xsl:when> >- <xsl:when test="count(key('item-by-status', 'available'))>0"> >+ <xsl:when test="$sumAv>0"> > <span class="available reallyavailable"> > <span class="AvailabilityLabel"><strong><xsl:text>Items available for loan: </xsl:text></strong></span> > <xsl:variable name="available_items" >@@ -1326,7 +1331,7 @@ > </xsl:choose> > > <xsl:choose> >- <xsl:when test="count(key('item-by-status', 'reference'))>0"> >+ <xsl:when test="$sumRef>0"> > <span class="available reference"> > <span class="AvailabilityLabel"><strong><xsl:text>Items available for reference: </xsl:text></strong></span> > <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> >@@ -1357,18 +1362,20 @@ > </xsl:choose> > > <xsl:choose> >- <xsl:when test="count(key('item-by-status', 'reallynotforloan'))>0"> >- <span class="unavailable"> >- <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span> >- <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')"/> >- <xsl:for-each select="$unavailable_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]"> >- <span> >+ <xsl:when test="number($sumAv+$sumRef) < number($itemcount)"> >+ <span class="unavailable"> >+ <span class="AvailabilityLabel"><strong><xsl:text>Not available: </xsl:text></strong></span> >+ >+ <!-- First the remaining not for loan categories --> >+ <xsl:variable name="unavailable_items" select="key('item-by-status', 'reallynotforloan')"/> >+ <xsl:for-each select="$unavailable_items[generate-id() = generate-id(key('item-by-substatus-and-branch', concat(items:substatus, ' ', items:homebranch))[1])]"> >+ <span> > <xsl:attribute name="class"> > ItemSummary > <xsl:value-of select="translate(items:substatus,' ','_')"/> > </xsl:attribute> > <xsl:if test="$singleBranchMode=0"> >- <span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span> >+ <span class="ItemBranch"><xsl:value-of select="items:homebranch"/><xsl:text> </xsl:text></span> > </xsl:if> > <span class='notforloandesc'><xsl:value-of select="items:substatus"/></span> > <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> >@@ -1381,55 +1388,62 @@ > <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> >- </span> >- </xsl:for-each> >- </span> >+ </span> >+ </xsl:for-each> >+ >+ <!-- Followed by other statuses --> >+ <xsl:if test="count(key('item-by-status', 'Checked out'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Checked out (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Withdrawn (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Lost (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Lost'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'Damaged'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Damaged (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'Pending hold'))>0"> >+ <span class="unavailable"> >+ <xsl:text>Pending hold (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'In transit'))>0"> >+ <span class="unavailable"> >+ <xsl:text>In transit (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'In transit'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ <xsl:if test="count(key('item-by-status', 'Waiting'))>0"> >+ <span class="unavailable"> >+ <xsl:text>On hold (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/> >+ <xsl:text>). </xsl:text> >+ </span> >+ </xsl:if> >+ </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> >- <xsl:value-of select="count(key('item-by-status', 'Checked out'))"/> >- <xsl:text>). </xsl:text> >- </span> >- </xsl:if> >- <xsl:if test="count(key('item-by-status', 'Withdrawn'))>0"> >- <span class="unavailable"> >- <xsl:text>Withdrawn (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'Withdrawn'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> >- <xsl:if test="$hidelostitems='0' and count(key('item-by-status', 'Lost'))>0"> >- <span class="unavailable"> >- <xsl:text>Lost (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'Lost'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> >- <xsl:if test="count(key('item-by-status', 'Damaged'))>0"> >- <span class="unavailable"> >- <xsl:text>Damaged (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'Damaged'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> >- <xsl:if test="count(key('item-by-status', 'Pending hold'))>0"> >- <span class="unavailable"> >- <xsl:text>Pending hold (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'Pending hold'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> >- <xsl:if test="count(key('item-by-status', 'In transit'))>0"> >- <span class="unavailable"> >- <xsl:text>In transit (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'In transit'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> >- <xsl:if test="count(key('item-by-status', 'Waiting'))>0"> >- <span class="unavailable"> >- <xsl:text>On hold (</xsl:text> >- <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/> >- <xsl:text>). </xsl:text> </span> >- </xsl:if> > </span> > <!-- End of Availability line --> > >-- >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 21260
:
105375
|
105376
|
109107
|
109108
|
109109
|
109110
|
109111
|
109112
|
109182
|
115265
|
115266
|
115267
|
115268
|
115269
|
115270
|
115271
|
118800
|
118801
|
118802
|
118803
|
118804
|
118805
|
118806
|
119569