Bug 28831: Add the new group by substatus-block
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 9 Sep 2021 09:18:01 +0000 (09:18 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 Oct 2021 09:28:41 +0000 (11:28 +0200)
Test plan:
Change OPACResultsUnavailableGroupingBy to substatus.
Verify the result on opac results. (You need a few unavailable items
with different statuses on a few branches.)

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl

index 8d0d010..40e73b4 100644 (file)
                                 </xsl:for-each>
                             </xsl:when>
                             <xsl:when test="$OPACResultsUnavailableGroupingBy='substatus'">
+                                <!-- Only group by substatus, do not list branch names and individual call numbers. Meant for large consortia -->
+                                <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:substatus=$current_substatus]"/>
+                                        <xsl:with-param name="max" select="0"/>
+                                        <xsl:with-param name="status_text">
+                                            <xsl:if test="items:status='other'">
+                                                <xsl:value-of select="exsl:node-set($other_status_list)/status[@english=$current_substatus]"/>
+                                            </xsl:if>
+                                            <xsl:if test="items:status='reallynotforloan'">
+                                                <xsl:value-of select="$current_substatus"/>
+                                            </xsl:if>
+                                        </xsl:with-param>
+                                        <xsl:with-param name="class_block" select="concat('unavailable_',$current_substatus)"/>
+                                        <xsl:with-param name="class_status" select="UnavailableSubstatus"/>
+                                    </xsl:call-template>
+                                </xsl:for-each>
                             </xsl:when>
                         </xsl:choose>
                     </span></xsl:if>