Bug 15141: Add MARC21 770/772 Supplement (parent) to OPAC and staff detail pages
authorKatrin Fischer <katrin.fischer.83@web.de>
Sun, 13 Sep 2020 16:07:44 +0000 (16:07 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 4 Nov 2020 11:59:34 +0000 (12:59 +0100)
Adds the 2 corresponding linking fields to the staff and OPAC detail pages:

770 - Supplement/Special Issue Entry (R)
https://www.loc.gov/marc/bibliographic/bd770.html

772 - Supplement Parent Entry (R)
https://www.loc.gov/marc/bibliographic/bd772.html

To test:
- Catalog records with 770/772 in Koha, examples can be found in the LOC
  documentation.
  - When UseControlNumber is set to Use and $w is added, a link will be built using $w
  - If there is no $w or UseControlNumber is Don't use, a link will be build using the title
- Verify that they display nicely in the OPAC and staff detail pages

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl

index 7dd2fed..ea90b2b 100644 (file)
             </span>
         </xsl:if>
 
+        <!-- 770 - Supplement/Special issue entry -->
+        <xsl:if test="marc:datafield[@tag=770]">
+            <span class="results_summary supplement"><span class="label">Supplement: </span>
+                <xsl:for-each select="marc:datafield[@tag=770]">
+                    <xsl:if test="marc:subfield[@code='i']">
+                        <span class="770_rel_info">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">i</xsl:with-param>
+                            </xsl:call-template>
+                            <xsl:text> </xsl:text>
+                        </span>
+                    </xsl:if>
+                    <a>
+                        <xsl:choose>
+                            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                                <xsl:attribute name="href">
+                                    /cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
+                                </xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                            <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">a_t</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:when>
+                        </xsl:choose>
+                    </a>
+                    <xsl:text> </xsl:text>
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
+                    </xsl:call-template>
+                    <xsl:choose>
+                        <xsl:when test="position()=last()"></xsl:when>
+                        <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </span>
+        </xsl:if>
+
+        <!-- 772 - Supplement parent entry -->
+        <xsl:if test="marc:datafield[@tag=772]">
+            <span class="results_summary supplement_parent"><span class="label">Supplement to: </span>
+                <xsl:for-each select="marc:datafield[@tag=772]">
+                    <xsl:if test="marc:subfield[@code='i']">
+                        <span class="772_rel_info">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">i</xsl:with-param>
+                            </xsl:call-template>
+                            <xsl:text> </xsl:text>
+                        </span>
+                    </xsl:if>
+                    <a>
+                        <xsl:choose>
+                            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                                <xsl:attribute name="href">
+                                    /cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
+                                </xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                            <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">a_t</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:when>
+                        </xsl:choose>
+                    </a>
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
+                    </xsl:call-template>
+                    <xsl:choose>
+                        <xsl:when test="position()=last()"></xsl:when>
+                        <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </span>
+        </xsl:if>
 
         <!--  775 Other Edition  -->
         <xsl:if test="marc:datafield[@tag=775]">
index f768671..685f4b1 100644 (file)
             </span>
         </xsl:if>
 
+        <!-- 770 - Supplement/Special issue entry -->
+        <xsl:if test="marc:datafield[@tag=770]">
+            <span class="results_summary supplement"><span class="label">Supplement: </span>
+                <xsl:for-each select="marc:datafield[@tag=770]">
+                    <xsl:if test="marc:subfield[@code='i']">
+                        <span class="770_rel_info">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">i</xsl:with-param>
+                            </xsl:call-template>
+                            <xsl:text> </xsl:text>
+                        </span>
+                    </xsl:if>
+                    <a>
+                        <xsl:choose>
+                            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                                <xsl:attribute name="href">
+                                    /cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
+                                </xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                            <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">a_t</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:when>
+                        </xsl:choose>
+                    </a>
+                    <xsl:text> </xsl:text>
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
+                    </xsl:call-template>
+                    <xsl:choose>
+                        <xsl:when test="position()=last()"></xsl:when>
+                        <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </span>
+        </xsl:if>
+
+        <!-- 772 - Supplement parent entry -->
+        <xsl:if test="marc:datafield[@tag=772]">
+            <span class="results_summary supplement_parent"><span class="label">Supplement to: </span>
+                <xsl:for-each select="marc:datafield[@tag=772]">
+                    <xsl:if test="marc:subfield[@code='i']">
+                        <span class="772_rel_info">
+                            <xsl:call-template name="subfieldSelect">
+                                <xsl:with-param name="codes">i</xsl:with-param>
+                            </xsl:call-template>
+                            <xsl:text> </xsl:text>
+                        </span>
+                    </xsl:if>
+                    <a>
+                        <xsl:choose>
+                            <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']">
+                                <xsl:attribute name="href">
+                                    /cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template>
+                                </xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''),true())"/></xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:choose>
+                            <xsl:when test="marc:subfield[@code='a'] or marc:subfield[@code='t']">
+                                <xsl:call-template name="subfieldSelect">
+                                    <xsl:with-param name="codes">a_t</xsl:with-param>
+                                </xsl:call-template>
+                            </xsl:when>
+                        </xsl:choose>
+                    </a>
+                    <xsl:call-template name="subfieldSelect">
+                        <xsl:with-param name="codes">bdghkmnr9usxyz</xsl:with-param>
+                    </xsl:call-template>
+                    <xsl:choose>
+                        <xsl:when test="position()=last()"></xsl:when>
+                        <xsl:otherwise><span class="separator"> | </span></xsl:otherwise>
+                    </xsl:choose>
+                </xsl:for-each>
+            </span>
+        </xsl:if>
+
         <!--  775 Other Edition  -->
         <xsl:if test="marc:datafield[@tag=775]">
         <span class="results_summary other_editions"><span class="label">Other editions: </span>