Bug 30430: UNIMARC XSLT add field B214 display

test plan :
- Apply patch
- Find a record with a B214
- Check on both Opac-Details and Opac-Result that the field is
  displayed.
- Do the same checks on catalogue/search results and catalogue/details
  in Staff interface.
- Add a 210 field to the record (legacy)
- It should be displayed as well

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
François Pichenot 2022-04-13 13:20:11 +02:00 committed by Tomas Cohen Arazi
parent 9b32080571
commit b82a37f11a
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
6 changed files with 221 additions and 22 deletions

View file

@ -140,6 +140,8 @@
<xsl:call-template name="tag_210" /> <xsl:call-template name="tag_210" />
<xsl:call-template name="tag_214" />
<xsl:call-template name="tag_215" /> <xsl:call-template name="tag_215" />
<xsl:if test="marc:controlfield[@tag=009]"> <xsl:if test="marc:controlfield[@tag=009]">

View file

@ -75,6 +75,8 @@
<xsl:call-template name="tag_210" /> <xsl:call-template name="tag_210" />
<xsl:call-template name="tag_214" />
<xsl:call-template name="tag_215" /> <xsl:call-template name="tag_215" />
</xsl:template> </xsl:template>

View file

@ -32,32 +32,129 @@
<span class="results_summary publication"> <span class="results_summary publication">
<span class="label">Publication: </span> <span class="label">Publication: </span>
<xsl:for-each select="marc:datafield[@tag=210]"> <xsl:for-each select="marc:datafield[@tag=210]">
<span> <xsl:if test="not (position() = 1)">
<br/>
</xsl:if>
<span class="valeur">
<xsl:call-template name="addClassRtl" /> <xsl:call-template name="addClassRtl" />
<xsl:for-each select="marc:subfield"> <xsl:for-each select="marc:subfield">
<xsl:choose> <xsl:choose>
<xsl:when test="@code='a'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='b'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='c' or @code='g'"> <xsl:when test="@code='c' or @code='g'">
<xsl:if test="position()>1"> <xsl:if test="position()>1">
<xsl:text> : </xsl:text> <xsl:text> : </xsl:text>
</xsl:if> </xsl:if>
<xsl:value-of select="."/> <a>
</xsl:when> <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&amp;q=<xsl:value-of select="."/>
<xsl:otherwise> </xsl:attribute>
<xsl:if test="position()>1"> <xsl:attribute name="title"> Search for publisher "<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text> <xsl:text>, </xsl:text>
</xsl:if> </xsl:if>
</xsl:when>
<xsl:when test="@code='d'">
<xsl:value-of select="."/> <xsl:value-of select="."/>
</xsl:otherwise> <xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose> </xsl:choose>
</xsl:for-each> </xsl:for-each>
<xsl:if test="not (position() = last())">
<xsl:text></xsl:text>
</xsl:if>
</span> </span>
</xsl:for-each> </xsl:for-each>
</span> </span>
</xsl:template> </xsl:template>
<xsl:template name="tag_214">
<xsl:for-each select="marc:datafield[@tag=214]">
<xsl:sort select="@ind2" data-type="number" />
<span class="results_summary publication">
<span class="label">
<xsl:choose>
<xsl:when test="@ind2=1">Production:
</xsl:when>
<xsl:when test="@ind2=2">Distribution:
</xsl:when>
<xsl:when test="@ind2=3">Manufacture:
</xsl:when>
<xsl:when test="@ind2=4">
<xsl:choose>
<xsl:when test="substring(marc:subfield[@code='d'],1,1)='C'">Copyright date:
</xsl:when>
<xsl:when test="substring(marc:subfield[@code='d'],1,1)='P'">Protection date:
</xsl:when>
<xsl:otherwise>Copyright date / protection date:
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>Publication:
</xsl:otherwise>
</xsl:choose>
</span>
<span>
<xsl:call-template name="addClassRtl" />
<xsl:for-each select="marc:subfield">
<xsl:choose>
<xsl:when test="@code='a'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='b'">
<xsl:value-of select="."/>
<xsl:if test="not(position()=1)">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='c'">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&amp;q=<xsl:value-of select="."/>
</xsl:attribute>
<xsl:attribute name="title"> Search for publisher "<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:when>
<xsl:when test="@code='d'">
<xsl:if test="not(position()=1)">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="substring(.,1,1)='C'">
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:when test="substring(.,1,1)='P'">
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</span>
</span>
</xsl:for-each>
</xsl:template>
<xsl:template name="tag_215"> <xsl:template name="tag_215">
<xsl:for-each select="marc:datafield[@tag=215]"> <xsl:for-each select="marc:datafield[@tag=215]">
<span class="results_summary description"> <span class="results_summary description">

View file

@ -188,6 +188,8 @@
<xsl:call-template name="tag_210" /> <xsl:call-template name="tag_210" />
<xsl:call-template name="tag_214" />
<xsl:call-template name="tag_215" /> <xsl:call-template name="tag_215" />
<!-- Build ISBN --> <!-- Build ISBN -->

View file

@ -153,6 +153,8 @@
<xsl:call-template name="tag_210" /> <xsl:call-template name="tag_210" />
<xsl:call-template name="tag_214" />
<xsl:call-template name="tag_215" /> <xsl:call-template name="tag_215" />
<span class="results_summary availability"> <span class="results_summary availability">

View file

@ -193,30 +193,124 @@
<span class="results_summary publication"> <span class="results_summary publication">
<span class="label">Publication: </span> <span class="label">Publication: </span>
<xsl:for-each select="marc:datafield[@tag=210]"> <xsl:for-each select="marc:datafield[@tag=210]">
<xsl:if test="not (position() = 1)">
<br/>
</xsl:if>
<span class="valeur">
<xsl:call-template name="addClassRtl" />
<xsl:for-each select="marc:subfield">
<xsl:choose>
<xsl:when test="@code='a'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='b'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='c' or @code='g'">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&amp;q=<xsl:value-of select="."/>
</xsl:attribute>
<xsl:attribute name="title"> Search for publisher "<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
<xsl:when test="@code='d'">
<xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>, </xsl:text>
</xsl:if>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</span>
</xsl:for-each>
</span>
</xsl:template>
<xsl:template name="tag_214">
<xsl:for-each select="marc:datafield[@tag=214]">
<xsl:sort select="@ind2" data-type="number" />
<span class="results_summary publication">
<span class="label">
<xsl:choose>
<xsl:when test="@ind2=1">Production:
</xsl:when>
<xsl:when test="@ind2=2">Distribution:
</xsl:when>
<xsl:when test="@ind2=3">Manufacture:
</xsl:when>
<xsl:when test="@ind2=4">
<xsl:choose>
<xsl:when test="substring(marc:subfield[@code='d'],1,1)='C'">Copyright date:
</xsl:when>
<xsl:when test="substring(marc:subfield[@code='d'],1,1)='P'">Protection date:
</xsl:when>
<xsl:otherwise>Copyright date / protection date:
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>Publication:
</xsl:otherwise>
</xsl:choose>
</span>
<span> <span>
<xsl:call-template name="addClassRtl" /> <xsl:call-template name="addClassRtl" />
<xsl:for-each select="marc:subfield"> <xsl:for-each select="marc:subfield">
<xsl:choose> <xsl:choose>
<xsl:when test="@code='c' or @code='g'"> <xsl:when test="@code='a'">
<xsl:if test="position()>1">
<xsl:text> : </xsl:text>
</xsl:if>
<xsl:value-of select="."/> <xsl:value-of select="."/>
<xsl:if test="position() != last()">
<xsl:text>: </xsl:text>
</xsl:if>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:when test="@code='b'">
<xsl:if test="position()>1"> <xsl:value-of select="."/>
<xsl:if test="not(position()=1)">
<xsl:text>, </xsl:text> <xsl:text>, </xsl:text>
</xsl:if> </xsl:if>
<xsl:value-of select="."/> </xsl:when>
</xsl:otherwise> <xsl:when test="@code='c'">
<a>
<xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&amp;q=<xsl:value-of select="."/>
</xsl:attribute>
<xsl:attribute name="title"> Search for publisher "<xsl:value-of select="."/>
<xsl:text>"</xsl:text>
</xsl:attribute>
<xsl:value-of select="."/>
</a>
</xsl:when>
<xsl:when test="@code='d'">
<xsl:if test="not(position()=1)">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:choose>
<xsl:when test="substring(.,1,1)='C'">
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:when test="substring(.,1,1)='P'">
<xsl:value-of select="substring(.,2)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="."/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
</xsl:choose> </xsl:choose>
</xsl:for-each> </xsl:for-each>
<xsl:if test="not (position() = last())">
<xsl:text></xsl:text>
</xsl:if>
</span> </span>
</xsl:for-each> </span>
</span> </xsl:for-each>
</xsl:template> </xsl:template>
<xsl:template name="tag_215"> <xsl:template name="tag_215">