From 88a0904dc7e86d3ba53b5e351154cc67ef74495d Mon Sep 17 00:00:00 2001
From: Kyle M Hall <kyle@bywatersolutions.com>
Date: Wed, 4 Dec 2013 12:24:38 -0500
Subject: [PATCH] [PASSED QA] Bug 6886 - Single branch mode should disable
 showing the branch name in front of all callnumbers - QA Followup

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Switching SingleBranchMode:

Tested with MARC21 and UNIMARC:
- "Don't allow" - branch is not shown in result list
- "Allow" - branch is shown for available items in result list

Changes are consistent over all 3 MARC flavours.
---
 .../opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl    | 16 ++++++----------
 .../opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl   |  7 ++-----
 .../opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl   |  8 +++-----
 3 files changed, 11 insertions(+), 20 deletions(-)

diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
index f3550d6..689641c 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
@@ -1062,11 +1062,9 @@
                </xsl:when>
                <xsl:otherwise>
                    <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
-                               <xsl:choose>
-                                   <xsl:when test="$singleBranchMode=0">
-                                       <xsl:value-of select="items:homebranch"/>
-                                   </xsl:when>
-                               </xsl:choose>
+                       <xsl:if test="$singleBranchMode=0">
+                           <xsl:value-of select="items:homebranch"/>
+                       </xsl:if>
                    <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
                                <xsl:text> (</xsl:text>
                                <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
@@ -1086,11 +1084,9 @@
                         <b><xsl:text>Copies available for reference: </xsl:text></b>
                         <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/>
                         <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
-                            <xsl:choose>
-                                <xsl:when test="$singleBranchMode=0">
-                                    <xsl:value-of select="items:homebranch"/>
-                                </xsl:when>
-                            </xsl:choose>
+                            <xsl:if test="$singleBranchMode=0">
+                                <xsl:value-of select="items:homebranch"/>
+                            </xsl:if>
                             <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
                             <xsl:text> (</xsl:text>
                             <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl
index 6c274bc..5f4b533 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/NORMARCslim2OPACResults.xsl
@@ -814,12 +814,9 @@
                        <xsl:variable name="reference_items"
                            select="key('item-by-status', 'reference')"/>
                        <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
-                       <xsl:choose>
-                           <xsl:when test="$singleBranchMode=0">
+                           <xsl:if test="$singleBranchMode=0">
                                <xsl:value-of select="items:homebranch"/>
-                           </xsl:when>
-                       </xsl:choose>
-
+                           </xsl:if>
 						   <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
                            <xsl:text> (</xsl:text>
                            <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
index 21193e5..9dde821 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
@@ -178,11 +178,9 @@
           <xsl:variable name="reference_items"
                         select="key('item-by-status', 'reference')"/>
           <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
-            <xsl:choose>
-              <xsl:when test="$singleBranchMode=0">
-                  <xsl:value-of select="items:homebranch"/>
-              </xsl:when>
-            </xsl:choose>
+            <xsl:if test="$singleBranchMode=0">
+                <xsl:value-of select="items:homebranch"/>
+            </xsl:if>
             <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber">[<xsl:value-of select="items:itemcallnumber"/>]</xsl:if>
             <xsl:text> (</xsl:text>
             <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/>
-- 
1.8.3.2