Distinguish between items marked 'not for loan' and 'Available'
authorJoshua Ferraro <jmf@liblime.com>
Wed, 4 Feb 2009 16:46:23 +0000 (10:46 -0600)
committerGalen Charlton <galen.charlton@liblime.com>
Mon, 9 Feb 2009 20:36:51 +0000 (14:36 -0600)
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'

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
C4/XSLT.pm
koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl

index 1bea9f1..8e77ea9 100644 (file)
@@ -134,17 +134,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";
index cade5d2..9fd857f 100644 (file)
         </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 -->
index 45a9780..1446b64 100644 (file)
             <!-- 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
index 4cb2421..feeff99 100644 (file)
                             </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])]">
                    </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>