Bug 15140: Add MARC21 776 to OPAC and staff display
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Thu, 16 Mar 2017 11:37:12 +0000 (12:37 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 26 Jul 2017 17:42:45 +0000 (14:42 -0300)
Adds code to opac and staff detail XSLT in order to show 776$t (or $a) and
a link based on 776$w (record control number). $w should be in the form:
    (MARCOrgCode)Record-number
For instance: (NL-AmRIJ)12345

Note: You should have enabled default opac/intranet XSLT view.

Test plan:
[1] Add two 776s (one with $t and $w and one with $t only)
[2] Verify that you see "Additional physical formats" on opac-detail. Does
    the link for $w work?
[3] Check intranet detail too.
[4] Empty 776$t and put text in $a. Check detail page again.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Felix Hemme <felix.hemme@thulb.uni-jena.de>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
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 55192cd..23131bd 100644 (file)
             </span>
         </xsl:if>
 
+<!-- MARC21 776 Additional Physical Form Entry -->
+    <xsl:if test="marc:datafield[@tag=776]">
+        <span class="results_summary add_physical_form">
+            <span class="label">Additional physical formats: </span>
+            <xsl:for-each select="marc:datafield[@tag=776]">
+                <xsl:variable name="linktext">
+                    <xsl:choose>
+                    <xsl:when test="marc:subfield[@code='t']">
+                        <xsl:value-of select="marc:subfield[@code='t']"/>
+                    </xsl:when>
+                    <xsl:when test="marc:subfield[@code='a']">
+                        <xsl:value-of select="marc:subfield[@code='a']"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text>No title</xsl:text>
+                    </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:choose>
+                <xsl:when test="marc:subfield[@code='w']">
+                    <a>
+                    <xsl:attribute name="href">
+                        <xsl:text>/cgi-bin/koha/catalogue/search.pl?q=Control-number:</xsl:text>
+                        <xsl:call-template name="extractControlNumber">
+                            <xsl:with-param name="subfieldW">
+                                <xsl:value-of select="marc:subfield[@code='w']"/>
+                            </xsl:with-param>
+                        </xsl:call-template>
+                    </xsl:attribute>
+                    <xsl:value-of select="$linktext"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$linktext"/>
+                </xsl:otherwise>
+                </xsl:choose>
+                <xsl:if test="position() != last()">
+                    <xsl:text>; </xsl:text>
+                </xsl:if>
+            </xsl:for-each>
+        </span>
+    </xsl:if>
+
 <!-- DDC classification -->
     <xsl:if test="marc:datafield[@tag=082]">
         <span class="results_summary ddc">
index 658fc36..74da731 100644 (file)
                 </span>
             </xsl:if>
 
+<!-- MARC21 776 Additional Physical Form Entry -->
+    <xsl:if test="marc:datafield[@tag=776]">
+        <span class="results_summary add_physical_form">
+            <span class="label">Additional physical formats: </span>
+            <xsl:for-each select="marc:datafield[@tag=776]">
+                <xsl:variable name="linktext">
+                    <xsl:choose>
+                    <xsl:when test="marc:subfield[@code='t']">
+                        <xsl:value-of select="marc:subfield[@code='t']"/>
+                    </xsl:when>
+                    <xsl:when test="marc:subfield[@code='a']">
+                        <xsl:value-of select="marc:subfield[@code='a']"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:text>No title</xsl:text>
+                    </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:choose>
+                <xsl:when test="marc:subfield[@code='w']">
+                    <a>
+                    <xsl:attribute name="href">
+                        <xsl:text>/cgi-bin/koha/opac-search.pl?q=Control-number:</xsl:text>
+                        <xsl:call-template name="extractControlNumber">
+                            <xsl:with-param name="subfieldW">
+                                <xsl:value-of select="marc:subfield[@code='w']"/>
+                            </xsl:with-param>
+                        </xsl:call-template>
+                    </xsl:attribute>
+                    <xsl:value-of select="$linktext"/>
+                    </a>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$linktext"/>
+                </xsl:otherwise>
+                </xsl:choose>
+                <xsl:if test="position() != last()">
+                    <xsl:text>; </xsl:text>
+                </xsl:if>
+            </xsl:for-each>
+        </span>
+    </xsl:if>
+
 <!-- DDC classification -->
     <xsl:if test="marc:datafield[@tag=082]">
         <span class="results_summary ddc">