Bug 6886 - OPAC XSLT respecting single branch mode
authorChris Cormack <chrisc@catalyst.net.nz>
Tue, 20 Sep 2011 03:27:08 +0000 (15:27 +1200)
committerPaul Poulain <paul.poulain@biblibre.com>
Wed, 5 Sep 2012 08:32:00 +0000 (10:32 +0200)
This is only for the MARC21 XSLT at this stage, follow up patch for
UNIMARC will come

Conflicts:

C4/XSLT.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
C4/XSLT.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl

index ac97e65..36a3bfc 100644 (file)
@@ -188,6 +188,7 @@ sub XSLTParse4Display {
                               UseAuthoritiesForTracings TraceSubjectSubdivisions
                               Display856uAsImage OPACDisplay856uAsImage 
                               UseControlNumber IntranetBiblioDefaultView BiblioDefaultView
+                              singleBranchMode
                               AlternateHoldingsField AlternateHoldingsSeparator / )
     {
         my $sp = C4::Context->preference( $syspref );
index 50abfeb..4df81b4 100644 (file)
@@ -359,7 +359,7 @@ OPAC:
               choices:
                   yes: "Don't allow"
                   no: Allow
-            - patrons to select their library on the OPAC.
+            - patrons to select their branch on the OPAC or show branch names with callnumbers.
         -
             - pref: SearchMyLibraryFirst
               choices:
index 2b5aacc..751c61a 100644 (file)
@@ -27,6 +27,7 @@
     <xsl:variable name="AlternateHoldingsField" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 1, 3)"/>
     <xsl:variable name="AlternateHoldingsSubfields" select="substring(marc:sysprefs/marc:syspref[@name='AlternateHoldingsField'], 4)"/>
     <xsl:variable name="AlternateHoldingsSeparator" select="marc:sysprefs/marc:syspref[@name='AlternateHoldingsSeparator']"/>
+    <xsl:variable name="singleBranchMode" select="marc:sysprefs/marc:syspref[@name='singleBranchMode']"/>
         <xsl:variable name="leader" select="marc:leader"/>
         <xsl:variable name="leader6" select="substring($leader,7,1)"/>
         <xsl:variable name="leader7" select="substring($leader,8,1)"/>
                        <b><xsl:text>Copies available for loan: </xsl:text></b>
                        <xsl:variable name="available_items"
                            select="key('item-by-status', 'available')"/>
-                       <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
-                           <xsl:value-of select="items:homebranch"/>
-                                                  <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)))"/>
-                           <xsl:text>)</xsl:text>
-<xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
-                       </xsl:for-each>
-                   </span>
+               <xsl:choose>
+               <xsl:when test="$singleBranchMode=1">
+               <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]">
+                   <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)))"/>
+                               <xsl:text>)</xsl:text>
+                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
+                               </xsl:for-each>
+               </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:value-of select="items:homebranch"/>
+                   <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)))"/>
+                               <xsl:text>)</xsl:text>
+                               <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose>
+                               </xsl:for-each>
+               </xsl:otherwise>
+               </xsl:choose>
+           </span>
+
                    </xsl:when>
                                   </xsl:choose>