Fixing a bug with notforloan being checked properly
authorChris Cormack <crc@liblime.com>
Sun, 30 Dec 2007 00:28:14 +0000 (18:28 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Sun, 30 Dec 2007 18:07:59 +0000 (12:07 -0600)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Circulation.pm

index 1694444..a689f8b 100644 (file)
@@ -715,6 +715,22 @@ sub CanBookBeIssued {
     {
         $issuingimpossible{NOT_FOR_LOAN} = 1;
     }
+       elsif ( !$item->{'notforloan'} ){
+               # we have to check itemtypes.notforloan also
+               if (C4::Context->preference('item-level_itypes')){
+                       # this should probably be a subroutine
+                       my $sth = $dbh->prepare("SELECT notforloan FROM itemtypes WHERE itemtype = ?");
+                       $sth->execute($item->{'itemtype'});
+                       my $notforloan=$sth->fetchrow_hashref();
+                       $sth->finish();
+                       if ($notforloan->{'notforloan'} == 1){
+                               $issuingimpossible{NOT_FOR_LOAN} = 1;                           
+                       }
+               }
+               elsif ($biblioitem->{'notforloan'} == 1){
+                       $issuingimpossible{NOT_FOR_LOAN} = 1;
+               }
+       }
     if ( $item->{'wthdrawn'} && $item->{'wthdrawn'} == 1 )
     {
         $issuingimpossible{WTHDRAWN} = 1;