From 90daab1d2e3f5838f7c3129f53bccb7f28e142b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pichenot?= <fpichenot@ville-roubaix.fr> Date: Wed, 13 Apr 2022 13:20:11 +0200 Subject: [PATCH] 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> --- .../en/xslt/UNIMARCslim2intranetDetail.xsl | 2 + .../en/xslt/UNIMARCslim2intranetResults.xsl | 2 + .../prog/en/xslt/UNIMARCslimUtils.xsl | 115 +++++++++++++++-- .../en/xslt/UNIMARCslim2OPACDetail.xsl | 2 + .../en/xslt/UNIMARCslim2OPACResults.xsl | 2 + .../bootstrap/en/xslt/UNIMARCslimUtils.xsl | 118 ++++++++++++++++-- 6 files changed, 220 insertions(+), 21 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl index 1fc5d88f3d..afb896fe89 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetDetail.xsl @@ -140,6 +140,8 @@ <xsl:call-template name="tag_210" /> + <xsl:call-template name="tag_214" /> + <xsl:call-template name="tag_215" /> <xsl:if test="marc:controlfield[@tag=009]"> diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl index 5d0a06da15..f982a6217e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslim2intranetResults.xsl @@ -75,6 +75,8 @@ <xsl:call-template name="tag_210" /> + <xsl:call-template name="tag_214" /> + <xsl:call-template name="tag_215" /> </xsl:template> diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl index a27353cb70..419fe9d6d2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/UNIMARCslimUtils.xsl @@ -32,32 +32,129 @@ <span class="results_summary publication"> <span class="label">Publication: </span> <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:for-each select="marc:subfield"> <xsl:choose> - <xsl:when test="@code='c' or @code='g'"> - <xsl:if test="position()>1"> - <xsl:text> : </xsl:text> + <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:otherwise> + <xsl:when test="@code='c' or @code='g'"> <xsl:if test="position()>1"> + <xsl:text> : </xsl:text> + </xsl:if> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&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:otherwise> + <xsl:if test="position() != last()"> + <xsl:text>, </xsl:text> + </xsl:if> + </xsl:when> </xsl:choose> </xsl:for-each> - <xsl:if test="not (position() = last())"> - <xsl:text> • </xsl:text> - </xsl:if> </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> + <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&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:for-each select="marc:datafield[@tag=215]"> <span class="results_summary description"> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl index 4066be9ab4..3fab572ee9 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl @@ -188,6 +188,8 @@ <xsl:call-template name="tag_210" /> + <xsl:call-template name="tag_214" /> + <xsl:call-template name="tag_215" /> <!-- Build ISBN --> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl index 9d8c7de16e..2d6711fb12 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACResults.xsl @@ -153,6 +153,8 @@ <xsl:call-template name="tag_210" /> + <xsl:call-template name="tag_214" /> + <xsl:call-template name="tag_215" /> <span class="results_summary availability"> diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl index 8c5b7fde95..bd8c1f430d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslimUtils.xsl @@ -193,30 +193,124 @@ <span class="results_summary publication"> <span class="label">Publication: </span> <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: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'"> - <xsl:if test="position()>1"> - <xsl:text> : </xsl:text> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&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> + <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:otherwise> - <xsl:if test="position()>1"> + <xsl:when test="@code='c'"> + <a> + <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?idx=pb&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:value-of select="."/> - </xsl:otherwise> + <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> - <xsl:if test="not (position() = last())"> - <xsl:text> • </xsl:text> - </xsl:if> </span> - </xsl:for-each> - </span> + </span> + </xsl:for-each> </xsl:template> <xsl:template name="tag_215"> -- 2.35.3