[Koha-patches] [PATCH] Distinguish between items marked 'not for loan' and 'Available'

Daniel Sweeney daniel.sweeney at liblime.com
Wed Feb 4 17:46:23 CET 2009


From: Joshua Ferraro <jmf at liblime.com>

This patch works with XSL* sysprefs == ON, a future patch will address XSL sysprefs==OFF

Items with notforloan set to a negative number still designate an 'ordered' status

Some items are marked 'not for loan' by setting that value at the item level, others by assigning
that value to that item's itemtype. This patch works for both scenarios.

Specific changes this patch introduces to the OPAC:

* Adds a new OPAC results page key 'Copies available for reference:'
* Changes 'Copies available at:' to 'Copies available for loan:'
* Changes the availability limit label in opac-advsearch from:
    'Only items currently available' to 'Only items currently
	available for loan or reference
* Displays the authorised value for the specific notforloan value in the OPAC detail page in
	parentheses next to 'Not for Loan'
---
 C4/XSLT.pm                                         |    9 +++++--
 .../opac-tmpl/prog/en/modules/opac-advsearch.tmpl  |    2 +-
 .../opac-tmpl/prog/en/modules/opac-detail.tmpl     |    4 +-
 .../prog/en/xslt/MARC21slim2OPACResults.xsl        |   23 ++++++++++++++++++-
 4 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/C4/XSLT.pm b/C4/XSLT.pm
index eeb2ec7..ca7ea96 100644
--- a/C4/XSLT.pm
+++ b/C4/XSLT.pm
@@ -130,17 +130,20 @@ sub buildKohaItemsNamespace {
     my @items = C4::Items::GetItemsInfo($biblionumber);
     my $branches = GetBranches();
     my $itemtypes = GetItemTypes();
+
     my $xml;
     for my $item (@items) {
         my $status;
+
         my ( $transfertwhen, $transfertfrom, $transfertto ) = C4::Circulation::GetTransfers($item->{itemnumber});
-        if ( $item->{notforloan} == -1 || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ||
+
+        if ( $itemtypes->{ $item->{itype} }->{notforloan} == 1 || $item->{notforloan} || $item->{onloan} || $item->{wthdrawn} || $item->{itemlost} || $item->{damaged} ||
              ($transfertwhen ne '') || $item->{itemnotforloan} ) {
             if ( $item->{notforloan} == -1) {
                 $status = "On order";
             } 
-            if ( $item->{itemnotforloan} ) {
-                $status = "Not for loan";
+            if ( $item->{itemnotforloan} > 0 || $item->{notforloan} > 0 || $itemtypes->{ $item->{itype} }->{notforloan} == 1 ) {
+                $status = "reference";
             }
             if ($item->{onloan}) {
                 $status = "Checked out";
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
index cade5d2..9fd857f 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -325,7 +325,7 @@
         </select>
         
         
-        <div style="margin-top:.4em"><label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available</label></div>
+        <div style="margin-top:.4em"><label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label></div>
     </fieldset></div>
 	<!-- /TMPL_UNLESS -->
 <!-- /AVAILABILITY LIMITS -->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index 45a9780..1446b64 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -266,9 +266,9 @@
             <!-- TMPL_IF NAME="serial" --><td><!-- TMPL_VAR NAME="serialseq" --> </td>
             <td><!-- TMPL_VAR NAME="publisheddate" --> </td><!-- /TMPL_IF -->
             <td><!-- TMPL_IF name="bi_notforloan" -->
-                    Not for loan
+                    Not for loan <!-- TMPL_IF NAME="notforloanvalue" -->(<!-- TMPL_VAR NAME="notforloanvalue" -->)<!-- /TMPL_IF -->
                 <!-- TMPL_ELSIF NAME="itypenotforloan" -->
-                    Not for loan
+                    Not for loan <!-- TMPL_IF NAME="notforloanvalue" -->(<!-- TMPL_VAR NAME="notforloanvalue" -->)<!-- /TMPL_IF -->
                 <!-- TMPL_ELSE -->
                     <!-- TMPL_IF name="datedue" -->
                     Checked out
diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
index 327f61e..f4afc81 100644
--- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
+++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl
@@ -833,11 +833,11 @@
                             </xsl:for-each>
                         </xsl:when>
 
-				   <xsl:when test="count(key('item-by-status', 'available'))=0">No copies available
+				   <xsl:when test="count(key('item-by-status', 'available'))=0 and count(key('item-by-status', 'reference'))=0">No copies available
 				   </xsl:when>
                    <xsl:when test="count(key('item-by-status', 'available'))>0">
                    <span class="available">
-                       <b><xsl:text>Copies available at: </xsl:text></b>
+                       <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])]">
@@ -851,6 +851,25 @@
                    </span>
                    </xsl:when>
 				   </xsl:choose>
+
+                   <xsl:choose>
+                   <xsl:when test="count(key('item-by-status', 'reference'))>0">
+                   <span class="available">
+                       <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:value-of select="items:homebranch"/>
+                           [<xsl:value-of select="items:itemcallnumber"/>]
+                           <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:when>
+                   </xsl:choose>
+
                    <xsl:if test="count(key('item-by-status', 'Checked out'))>0">
                    <span class="unavailable">
                        <xsl:text>Checked out (</xsl:text>
-- 
1.5.5.GIT



More information about the Koha-patches mailing list