Bug 34020: Preserve order of subfields in 264 display

When ordered $a$b$a$b$c in the MARC object, 264 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

1) Edit a record and add/update a 264 fields to have subfields a, b, a,
   b, c in that order
1) Search for record in staff and opac, see subfields displayed in
   order "aabbc" in results
2) View the details page for the record in staff and opac, note same
   order
3) Apply the patch, restart all
4) Confirm staff and opac, results and details now follow the order of
   the subfields in the record's field

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-10-18 12:00:05 +00:00 committed by Tomas Cohen Arazi
parent c86d4ff67b
commit 1349fc60da
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 52 additions and 65 deletions

View file

@ -281,41 +281,34 @@
</xsl:when>
</xsl:choose>
<xsl:if test="$field/marc:subfield[@code='a']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$url='1'">
<xsl:if test="$field/marc:subfield[@code='b']">
<a>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/></xsl:attribute>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</a>
<xsl:for-each select="marc:subfield">
<xsl:if test="@code='a'">
<xsl:value-of select="current()"/>
</xsl:if>
<xsl:if test="@code='b'">
<xsl:choose>
<xsl:when test="$url='1'">
<a>
<xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute>
<xsl:value-of select="current()"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$field/marc:subfield[@code='b']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
<xsl:if test="@code='c'">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:value-of select="current()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</span>
</xsl:template>

View file

@ -279,40 +279,34 @@
</xsl:when>
</xsl:choose>
<xsl:if test="$field/marc:subfield[@code='a']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$url='1'">
<xsl:if test="$field/marc:subfield[@code='b']">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri($field/marc:subfield[@code='b'], true())"/></xsl:attribute>
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</a>
<xsl:for-each select="marc:subfield">
<xsl:if test="@code='a'">
<xsl:value-of select="current()"/>
</xsl:if>
<xsl:if test="@code='b'">
<xsl:choose>
<xsl:when test="$url='1'">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Provider:<xsl:value-of select="str:encode-uri(current(), true())"/></xsl:attribute>
<xsl:value-of select="current()"/>
</a>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="current()"/>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<xsl:if test="$field/marc:subfield[@code='b']">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">b</xsl:with-param>
</xsl:call-template>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
<xsl:text> </xsl:text>
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">c</xsl:with-param>
<xsl:if test="@code='c'">
<xsl:call-template name="chopPunctuation">
<xsl:with-param name="chopString">
<xsl:value-of select="current()"/>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:if>
<xsl:if test="position() != last()">
<xsl:text> </xsl:text>
</xsl:if>
</xsl:for-each>
</span>
</xsl:template>