From 2a3f9fee4ddcd2532359eab03657337fd6706c46 Mon Sep 17 00:00:00 2001
From: Tomas Cohen Arazi <tomascohen@gmail.com>
Date: Mon, 15 Sep 2014 10:44:16 -0300
Subject: [PATCH] [PASSED QA] Bug 12901: (consistency followup) add
 buildBiblioDefaultViewURL to MARC21 XSLT

Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>

http://bugs.koha-community.org/show_bug.cgi?id=9828

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
---
 .../bootstrap/en/xslt/MARC21slim2OPACResults.xsl   | 26 +++++++++-------------
 .../bootstrap/en/xslt/MARC21slimUtils.xsl          | 21 +++++++++++++++++
 2 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
index e5405b8..4fd9cd6 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
@@ -403,22 +403,16 @@
            </xsl:call-template>
         </xsl:if>
 
-        <a><xsl:attribute name="href">
-            <xsl:choose>
-                <xsl:when test="$BiblioDefaultView='normal'">
-                    /cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/>
-                </xsl:when>
-                <xsl:when test="$BiblioDefaultView='isbd'">
-                    /cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=<xsl:value-of select="$biblionumber"/>
-                </xsl:when>
-                <xsl:when test="$BiblioDefaultView='marc'">
-                    /cgi-bin/koha/opac-MARCdetail.pl?biblionumber=<xsl:value-of select="$biblionumber"/>
-                </xsl:when>
-                <xsl:otherwise>
-                    /cgi-bin/koha/opac-detail.pl?biblionumber=<xsl:value-of select="$biblionumber"/>
-                </xsl:otherwise>
-            </xsl:choose>
-        </xsl:attribute><xsl:attribute name="class">title</xsl:attribute>
+    <a>
+        <xsl:attribute name="href">
+            <xsl:call-template name="buildBiblioDefaultViewURL">
+                <xsl:with-param name="BiblioDefaultView">
+                    <xsl:value-of select="$BiblioDefaultView"/>
+                </xsl:with-param>
+            </xsl:call-template>
+            <xsl:value-of select="$biblionumber"/>
+        </xsl:attribute>
+        <xsl:attribute name="class">title</xsl:attribute>
 
         <xsl:if test="marc:datafield[@tag=245]">
         <xsl:for-each select="marc:datafield[@tag=245]">
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl
index 4780b7b..273b42d 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl
@@ -72,6 +72,27 @@
 		</xsl:if>
 	</xsl:template>
 
+    <xsl:template name="buildBiblioDefaultViewURL">
+      <xsl:param name="BiblioDefaultView"/>
+      <xsl:choose>
+          <xsl:when test="$BiblioDefaultView='normal'">
+              <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$BiblioDefaultView='isbd'">
+              <xsl:text>/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$BiblioDefaultView='labeled_marc'">
+              <xsl:text>/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:when test="$BiblioDefaultView='marc'">
+              <xsl:text>/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=</xsl:text>
+          </xsl:when>
+          <xsl:otherwise>
+              <xsl:text>/cgi-bin/koha/catalogue/detail.pl?biblionumber=</xsl:text>
+          </xsl:otherwise>
+      </xsl:choose>
+    </xsl:template>
+
 	<xsl:template name="chopPunctuation">
 		<xsl:param name="chopString"/>
 		<xsl:variable name="length" select="string-length($chopString)"/>
-- 
1.9.1