Bug 15594: preserve sequence of 260 subfields in (staff) detail page
authorBlou <blou@inlibro.com>
Wed, 8 Dec 2021 21:45:29 +0000 (16:45 -0500)
committerFridolin Somers <fridolin.somers@biblibre.com>
Wed, 9 Mar 2022 09:03:34 +0000 (23:03 -1000)
When ordered $a$b$a$b$c in the MARC object, 260 subfields are displayed
$a$a$b$b$c.  This goes against the standard.

This patch preserves the order.

0) create a notice with $a$b$a subfields.  In that (mixed) order.
1) Go to staff detail page and see the fields displayed as "aab"
2) apply the patch
3) validate the aba display.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl

index 7f14c29..976fbb0 100644 (file)
             <xsl:when test="marc:datafield[@tag=260]">
                 <span class="results_summary publisher"><span class="label">Publication details: </span>
                     <xsl:for-each select="marc:datafield[@tag=260]">
-                        <xsl:for-each select="marc:subfield[@code='a']">
+                        <xsl:for-each select="marc:subfield">
+                        <xsl:if test="@code='a'">
                             <a>
-                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=pl:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
-                                <xsl:value-of select="."/>
+                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=pl:"<xsl:value-of select="str:encode-uri(current(), true())"/>"</xsl:attribute>
+                                <xsl:value-of select="current()"/>
                             </a>
                             <xsl:if test="position() != last()">
                                 <xsl:text> </xsl:text>
                             </xsl:if>
-                        </xsl:for-each>
-                        <xsl:text> </xsl:text>
-                        <xsl:if test="marc:subfield[@code='b']">
-                        <a>
-                            <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Provider:"<xsl:value-of select="str:encode-uri(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:text> </xsl:text>
                         </xsl:if>
-                        <xsl:text> </xsl:text>
-                        <xsl:for-each select="marc:subfield[@code='c']">
+                        <xsl:if test="@code='b'">
                             <a>
-                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=copydate:"<xsl:value-of select="str:encode-uri(., true())"/>"</xsl:attribute>
-                                <xsl:value-of select="."/>
+                                <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:text> </xsl:text>
+                        </xsl:if>
+                        <xsl:if test="@code='c'">
+                            <a>
+                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=copydate:"<xsl:value-of select="str:encode-uri(current(), true())"/>"</xsl:attribute>
+                                <xsl:value-of select="current()"/>
                             </a>
                             <xsl:if test="position() != last()">
                                 <xsl:text> </xsl:text>
                             </xsl:if>
-                        </xsl:for-each>
-                        <xsl:text> </xsl:text>
-                        <xsl:call-template name="chopPunctuation">
-                          <xsl:with-param name="chopString">
-                            <xsl:call-template name="subfieldSelect">
-                                <xsl:with-param name="codes">g</xsl:with-param>
+                            <xsl:text> </xsl:text>
+                        </xsl:if>
+                        <xsl:if test="@code='g'">
+                            <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:for-each>
                             <xsl:choose><xsl:when test="position()=last()"><xsl:text></xsl:text></xsl:when><xsl:otherwise><xsl:text>; </xsl:text></xsl:otherwise></xsl:choose>
                     </xsl:for-each>
                 </span>