From dcecb281ddf996c3b4743e38bfd0aacd3663ac38 Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Mon, 12 Nov 2018 11:48:23 +0100
Subject: [PATCH] Bug 21808: Field 711 is not handled correctly in showAuthor
 XSLT for relator term or code
Content-Type: text/plain; charset=utf-8

The test should check $4 or $e for fields ne 111,711.
And should check $4 or $j for 111,711.

Test plan:
Edit a record, add a meeting in 711 without $4 but with $j.
Without this patch the term is not visible, with this patch it is.
---
 koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl | 2 +-
 koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index f3d0fe7..7cdd98f 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
@@ -1437,7 +1437,7 @@
 
     <!-- add relator code too between brackets-->
     <!-- #13383 include relator code j for field 111 -->
-            <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
+            <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
                 <span class="relatorcode">
                     <xsl:text> [</xsl:text>
                     <xsl:choose>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index 9fe561d..e3260e3 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
@@ -1526,7 +1526,7 @@
                 </span></span></span>
 
                 <!-- #13383 include relator code j for field 111 also include 711$e 'Subordinate unit' -->
-                <xsl:if test="marc:subfield[@code='4' or @code='e'][not(parent::*[@tag=111])] or (self::*[@tag=111] and marc:subfield[@code='4' or @code='j'][. != ''])">
+                <xsl:if test="(@tag!=111 and @tag!=711 and marc:subfield[@code='4' or @code='e']) or ((@tag=111 or @tag=711) and marc:subfield[@code='4' or @code='j'])">
 
                     <span class="relatorcode">
                         <xsl:text> [</xsl:text>
-- 
2.1.4