From 9169aced2376c7e8ba0a03d319fd69743b775716 Mon Sep 17 00:00:00 2001
From: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>
Date: Tue, 15 Oct 2024 15:56:01 -0400
Subject: [PATCH] Bug 38180: Don't show label if 520 ind1=8 (MARC21)

This patch amends the display constant for field 520 if the first
indicator is set to 8. According to MARC21 documentation
(https://www.loc.gov/marc/bibliographic/bd520.html), the field's
labels depend on the value of indicator 1.

First Indicator	Second Indicator
Display constant controller
empty - Summary
0 - Subject
1 - Review
2 - Scope and content
3 - Abstract
4 - Content advice
8 - No display constant generated

Prior to this patch, a 520 field with ind1 = 8 is displayed as
'Summary'. After this patch, there is no label.

To test:
1. Create or edit a record, and add 7 x 520 tags:
   - Add one 520 tag with no value in ind1, enter 'Summary' in 520$a
   - Add one 520 tag with 0 in ind1, enter 'Subject' in 520$a
   - Add one 520 tag with 1 in ind1, enter 'Review' in 520$a
   - Add one 520 tag with 2 in ind1, enter 'Scope and content' in 520$a
   - Add one 520 tag with 3 in ind1, enter 'Abstract' in 520$a
   - Add one 520 tag with 4 in ind1, enter 'Content advice' in 520$a
   - Add one 520 tag with 8 in ind1, enter 'No display constant
     generated' in 520$a

2. View the record in the staff interface
   --> The labels should be
       - 'Summary' for the field that contains 'Summary' (OK)
       - 'Subject' for the field that contains 'Subject' (OK)
       - 'Review' for the field that contains 'Review' (OK)
       - 'Scope and content' for the field that contains 'Scope and
         content' (OK)
       - 'Abstract' for the field that contains 'Abstract' (OK)
       - 'Content advice' for the field that contains 'Content advice'
         (OK)
       - 'Summary' for the field that contains 'Subject' **(NOT OK)**

3. View the record in the OPAC
   --> The labels should be
       - 'Summary' for the field that contains 'Summary' (OK)
       - 'Subject' for the field that contains 'Subject' (OK)
       - 'Review' for the field that contains 'Review' (OK)
       - 'Scope and content' for the field that contains 'Scope and
         content' (OK)
       - 'Abstract' for the field that contains 'Abstract' (OK)
       - 'Content advice' for the field that contains 'Content advice'
         (OK)
       - 'Summary' for the field that contains 'Subject' **(NOT OK)**

4. Apply patch

5. Repeat step 2 (view the record in the staff interface; make sure to
   refresh the page)
   --> The labels should be
       - 'Summary' for the field that contains 'Summary' (OK)
       - 'Subject' for the field that contains 'Subject' (OK)
       - 'Review' for the field that contains 'Review' (OK)
       - 'Scope and content' for the field that contains 'Scope and
         content' (OK)
       - 'Abstract' for the field that contains 'Abstract' (OK)
       - 'Content advice' for the field that contains 'Content advice'
         (OK)
       - Nothing for the field that contains 'Subject' (OK!!)

6. Repeat step 3 (view the record in the OPAC; make sure to refresh the
   page)
   --> The labels should be
       - 'Summary' for the field that contains 'Summary' (OK)
       - 'Subject' for the field that contains 'Subject' (OK)
       - 'Review' for the field that contains 'Review' (OK)
       - 'Scope and content' for the field that contains 'Scope and
         content' (OK)
       - 'Abstract' for the field that contains 'Abstract' (OK)
       - 'Content advice' for the field that contains 'Content advice'
         (OK)
       - Nothing for the field that contains 'Subject' (OK!!)

https://bugs.koha-community.org/show_bug.cgi?id=38081
Signed-off-by: esther <esther@bywatersolutions.com>
---
 .../intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl     | 1 +
 koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
index 7080456e09..5e03dc6d36 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
@@ -1094,6 +1094,7 @@
                         <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
                         <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
                         <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
+                        <xsl:when test="@ind1=8"><xsl:text></xsl:text></xsl:when>
                         <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
                     </xsl:choose>
                 </span>
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
index 9c61e67898..b90bc99a64 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl
@@ -1302,6 +1302,7 @@
                         <xsl:when test="@ind1=2"><xsl:text>Scope and content: </xsl:text></xsl:when>
                         <xsl:when test="@ind1=3"><xsl:text>Abstract: </xsl:text></xsl:when>
                         <xsl:when test="@ind1=4"><xsl:text>Content advice: </xsl:text></xsl:when>
+                        <xsl:when test="@ind1=8"><xsl:text></xsl:text></xsl:when>
                         <xsl:otherwise><xsl:text>Summary: </xsl:text></xsl:otherwise>
                     </xsl:choose>
                 </span>
-- 
2.39.5