[Koha-patches] [PATCH] Bug 2655: Partial fix for Items on hold shelf showing as available.

Garry Collum gcollum at gmail.com
Sun Feb 21 01:16:23 CET 2010


Fixes the opac results (opac-search.pl), if using xsl to transform data.  I have no way to test UNIMARC results, if someone could test it for me.
---
 C4/XSLT.pm                                         |   10 ++++++++--
 .../prog/en/xslt/MARC21slim2OPACResults.xsl        |    6 ++++++
 .../prog/en/xslt/UNIMARCslim2OPACResults.xsl       |    7 +++++++
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index a5cf211..8dd7840 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -26,6 +26,7 @@ use C4::Items;
 use C4::Koha;
 use C4::Biblio;
 use C4::Circulation;
+use C4::Reserves;
 use Encode;
 use XML::LibXML;
 use XML::LibXSLT;
@@ -173,8 +174,10 @@ sub buildKohaItemsNamespace {
 
         my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber});
 
-        if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ||
-             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} ) {
+	my ( $reservestatus, $reserveitem ) = C4::Reserves::CheckReserves($item->{itemnumber});
+
+        if ( $itemtypes->{ $item->{itype} }->{notforloan} || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} || 
+             (defined $transfertwhen && $transfertwhen ne '') || $item->{itemnotforloan} || (defined $reservestatus && $reservestatus eq "Waiting") ){ 
             if ( $item->{notforloan} < 0) {
                 $status = "On order";
             } 
@@ -196,6 +199,9 @@ sub buildKohaItemsNamespace {
             if (defined $transfertwhen && $transfertwhen ne '') {
                 $status = 'In transit';
             }
+            if (defined $reservestatus && $reservestatus eq "Waiting") {
+                $status = 'Waiting';
+            }
         } else {
             $status = "available";
         }
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
index 0ee5a73..f146aba 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
@@ -1010,6 +1010,12 @@
                        <xsl:value-of select="count(key('item-by-status', 'In transit'))"/>
                        <xsl:text>). </xsl:text>                   </span>
                    </xsl:if>
+                    <xsl:if test="count(key('item-by-status', 'Waiting'))>0">
+                   <span class="unavailable">
+                       <xsl:text>On hold (</xsl:text>
+                       <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
+                       <xsl:text>). </xsl:text>                   </span>
+                   </xsl:if>
                </span>
     </xsl:template>
 
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
index 612295e..6917ca2 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/UNIMARCslim2OPACResults.xsl
@@ -189,6 +189,13 @@
         <xsl:text>). </xsl:text>
       </span>
     </xsl:if>
+    <xsl:if test="count(key('item-by-status', 'Waiting'))>0">
+      <span class="unavailable">
+        <xsl:text>On hold (</xsl:text>
+        <xsl:value-of select="count(key('item-by-status', 'Waiting'))"/>
+        <xsl:text>). </xsl:text>
+      </span>
+    </xsl:if>
   </span>
 
 </xsl:template>
-- 
1.5.6.5




More information about the Koha-patches mailing list