Bugzilla – Attachment 188259 Details for
Bug 32419
Show availability in list view in staff interface
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32419: WIP
Bug-32419-WIP.patch (text/plain), 12.42 KB, created by
Aleisha Amohia
on 2025-10-21 20:02:14 UTC
(
hide
)
Description:
Bug 32419: WIP
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2025-10-21 20:02:14 UTC
Size:
12.42 KB
patch
obsolete
>From 36ec0397dc3da749cb6891d06b317b7b83bbe0e1 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleisha@catalyst.net.nz> >Date: Tue, 21 Oct 2025 20:01:47 +0000 >Subject: [PATCH] Bug 32419: WIP > >--- > .../en/xslt/MARC21slim2intranetResults.xsl | 132 +++++++++++++++++- > virtualshelves/shelves.pl | 14 +- > 2 files changed, 141 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >index b03a8c1f9dc..878f3501083 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetResults.xsl >@@ -3,21 +3,29 @@ > <!DOCTYPE stylesheet> > <xsl:stylesheet version="1.0" > xmlns:marc="http://www.loc.gov/MARC21/slim" >+ xmlns:items="http://www.koha-community.org/items" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >+ xmlns:exsl="http://exslt.org/common" > xmlns:str="http://exslt.org/strings" >- exclude-result-prefixes="marc str"> >+ exclude-result-prefixes="marc items str" extension-element-prefixes="exsl"> > <xsl:import href="MARC21slimUtils.xsl"/> > <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> > >+ <xsl:key name="item-by-status" match="items:item" use="items:status"/> >+ > <xsl:template match="/"> > <xsl:apply-templates/> > </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])"/> > <xsl:variable name="UseControlNumber" select="marc:sysprefs/marc:syspref[@name='UseControlNumber']"/> > >+ <xsl:variable name="ResultsMaxItems" select="number(marc:sysprefs/marc:syspref[@name='maxItemsInSearchResults']+0)"/> >+ <xsl:variable name="ResultsLibrary" select="marc:sysprefs/marc:syspref[@name='StaffSearchResultsDisplayBranch']"/> > <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/> > <xsl:variable name="Show856uAsImage" select="marc:sysprefs/marc:syspref[@name='Display856uAsImage']"/> > <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/> >@@ -973,6 +981,128 @@ > </span> > </xsl:if> > >+ <!-- Availability line --> >+ <div class="results_summary availability"> >+ >+ <xsl:variable name="item_status_list"> >+ <status english="Checked out">Checked out</status> >+ <status english="Withdrawn">Withdrawn</status> >+ <status english="Lost">Lost</status> >+ <status english="Damaged">Damaged</status> >+ <status english="Pending hold">Pending hold</status> >+ <status english="In transit">In transit</status> >+ <status english="Hold waiting">On hold</status> >+ <status english="Recall waiting">Waiting recall</status> >+ <status english="Not for loan">Not for loan</status> >+ </xsl:variable> >+ >+ <span class="label">Availability: </span> >+ >+ <xsl:choose> >+ <!-- When there are no items, try alternate holdings --> >+ <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])"/> >+ <xsl:for-each select="marc:datafield[@tag=$AlternateHoldingsField][1]"> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes"><xsl:value-of select="$AlternateHoldingsSubfields"/></xsl:with-param> >+ <xsl:with-param name="delimeter"><xsl:value-of select="$AlternateHoldingsSeparator"/></xsl:with-param> >+ </xsl:call-template> >+ </xsl:for-each> >+ (<xsl:value-of select="$AlternateHoldingsCount"/>) >+ </xsl:when> >+ <xsl:otherwise><span class="noitems">No items available.</span> </xsl:otherwise> >+ </xsl:choose> >+ </xsl:when> >+ >+ <xsl:otherwise> >+ <xsl:variable name="sumAv" select="count(key('item-by-status', 'available'))"/> >+ <xsl:variable name="sumRef" select="count(key('item-by-status', 'reference'))"/> >+ >+ <!-- Availability part 1: ITEMS FOR LOAN --> >+ <xsl:if 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" select="key('item-by-status', 'available')"/> >+ <!-- group by branch, see also pref StaffSearchResultsDisplayBranch --> >+ <xsl:for-each select="$available_items[not(items:resultbranch=preceding-sibling::*[items:status='available']/items:resultbranch)]"> >+ <xsl:sort select="items:resultbranch"/> >+ <xsl:variable name="currentbranch" select="items:resultbranch"/> >+ <span class="ItemSummary"> >+ <xsl:call-template name="listCallNumbers"> >+ <xsl:with-param name="items" select="$available_items[items:resultbranch=$currentbranch]"/> >+ <xsl:with-param name="max" select="$ResultsMaxItems"/> >+ <xsl:with-param name="status_text" select="$currentbranch"/> >+ <xsl:with-param name="class_block" select="'available'"/> >+ <xsl:with-param name="class_status" select="'ItemBranch'"/> >+ </xsl:call-template> >+ </span> >+ </xsl:for-each> >+ </span></xsl:if> >+ >+ <!-- Availability part 2: ITEMS FOR REFERENCE (see also pref Reference_NFL_Statuses) --> >+ <xsl:if 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')"/> >+ <!-- group by branch, then by substatus --> >+ <xsl:for-each select="$reference_items[not(items:resultbranch=preceding-sibling::*[items:status='reference']/items:resultbranch)]"> >+ <xsl:sort select="items:resultbranch"/> >+ <xsl:variable name="currentbranch" select="items:resultbranch"/> >+ <xsl:for-each select="$reference_items[not(items:substatus=preceding-sibling::*[items:status='reference']/items:substatus)]"> >+ <xsl:sort select="items:substatus"/> >+ <xsl:variable name="current_substatus" select="items:substatus"/> >+ <span class="ItemSummary"> >+ <xsl:call-template name="listCallNumbers"> >+ <xsl:with-param name="items" select="$reference_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/> >+ <xsl:with-param name="max" select="$ResultsMaxItems"/> >+ <xsl:with-param name="status_text"> >+ <xsl:value-of select="concat($currentbranch,': ')"/> >+ <xsl:value-of select="exsl:node-set($item_status_list)/status[@english=$current_substatus]|$current_substatus"/> >+ <!-- Note that value-of here picks string value of first node only from the union; keep in mind too that current_substatus may contain an authorised value --> >+ </xsl:with-param> >+ <xsl:with-param name="class_block" select="concat('notforloandesc_',$current_substatus)"/> >+ <xsl:with-param name="class_status" select="'ItemBranch'"/> >+ </xsl:call-template> >+ </span> >+ </xsl:for-each> >+ </xsl:for-each> >+ </span></xsl:if> >+ >+ <!-- Availability part 3: UNAVAILABLE ITEMS (see also pref Reference_NFL_Statuses); status reallynotforloan or status other --> >+ <xsl:if test="number($sumAv+$sumRef) < number($itemcount)"><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')|key('item-by-status', 'other')"/> >+ <xsl:choose> >+ <!-- First group by branch --> >+ <xsl:for-each select="items:items/items:item[not(items:resultbranch=preceding-sibling::*/items:resultbranch)]"> >+ <xsl:sort select="items:resultbranch"/> >+ <xsl:variable name="currentbranch" select="items:resultbranch"/> >+ <span class="ItemSummary unavailable"> >+ <!-- Within same branch, group by substatus --> >+ <xsl:for-each select="$unavailable_items[not(items:substatus=preceding-sibling::*[items:status='reallynotforloan' or items:status='other']/items:substatus)]"> >+ <xsl:sort select="items:substatus"/> >+ <xsl:variable name="current_substatus" select="items:substatus"/> >+ <xsl:call-template name="listCallNumbers"> >+ <xsl:with-param name="items" select="$unavailable_items[items:resultbranch=$currentbranch and items:substatus=$current_substatus]"/> >+ <xsl:with-param name="status_text"> >+ <xsl:value-of select="$currentbranch"/> >+ <xsl:text>: </xsl:text> >+ <xsl:value-of select="exsl:node-set($item_status_list)/status[@english=$current_substatus]|$current_substatus"/><!-- See former comment on value-of and union --> >+ </xsl:with-param> >+ <xsl:with-param name="class_block" select="concat('unavailable_',items:substatus)"/> >+ <xsl:with-param name="class_status" select="'ItemBranch'"/> >+ </xsl:call-template> >+ </xsl:for-each> >+ </span> >+ </xsl:for-each> >+ </xsl:choose> >+ </span></xsl:if> >+ >+ </xsl:otherwise> >+ </xsl:choose> >+ </div> >+ <!-- End of Availability line --> >+ > <xsl:call-template name="host-item-entries"> > <xsl:with-param name="UseControlNumber" select="$UseControlNumber"/> > </xsl:call-template> >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index f64caf75428..0fcd17e8095 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -328,12 +328,18 @@ if ( $op eq 'view' ) { > my $biblio = Koha::Biblios->find($biblionumber); > my $record = $biblio->metadata->record; > >+ #my $items = $biblio->items; >+ my $variables = { anonymous_session => ($loggedinuser) ? 0 : 1 }; >+ > $this_item->{XSLTBloc} = XSLTParse4Display( > { >- biblionumber => $biblionumber, >- record => $record, >- xsl_syspref => 'XSLTListsDisplay', >- fix_amps => 1, >+ biblionumber => $biblionumber, >+ record => $record, >+ xsl_syspref => 'XSLTListsDisplay', >+ fix_amps => 1, >+ xslt_variables => $variables, >+ >+ #items_rs => $items->reset, > } > ); > >-- >2.39.5
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 32419
:
188259
|
188537