[Koha-patches] [PATCH] [HEAD] (bug #2893) Allow loan forcing if a syspref is set

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Mon Jan 5 09:25:59 CET 2009


If the syspref 'AllowNotForLoanForcing'(YESNO) is set to YES, the librarian is able to force a loan on an item set as "not for
loan".
If the item is not for loan and the syspref is set to YES, koha will ask to the librarian if he really want to check-out it,
else do nothing.
---
 C4/Circulation.pm                                  |   39 +++++++++++---------
 .../prog/en/modules/circ/circulation.tmpl          |    5 ++-
 2 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index fb0cbb0..4294c2b 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -711,27 +711,32 @@ sub CanBookBeIssued {
     unless ( $item->{barcode} ) {
         $issuingimpossible{UNKNOWN_BARCODE} = 1;
     }
+
     if (   $item->{'notforloan'}
         && $item->{'notforloan'} > 0 )
     {
-        $issuingimpossible{NOT_FOR_LOAN} = 1;
+        if(!C4::Context->preference("AllowNotForLoanForcing")){
+            $issuingimpossible{NOT_FOR_LOAN} = 1;
+        }else{
+            $needsconfirmation{NOT_FOR_LOAN_FORCING} = 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;
+        }
     }
-	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;
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
index a41e0f2..fe6c8d7 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -119,6 +119,10 @@ $.tablesorter.addParser({
     <label for="cancelreserve">Cancel Reserve</label>
     </p>
 <!-- /TMPL_IF -->
+<!-- TMPL_IF NAME="NOT_FOR_LOAN_FORCING" -->
+    <h3>Not for loan</h3>
+    <p>Item not for loan, are you sure you want to loan it?</p>
+<!-- /TMPL_IF -->
 
 <!-- TMPL_IF NAME="RESERVE_WAITING" -->
     <p>
@@ -141,7 +145,6 @@ $.tablesorter.addParser({
     <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
     <input type="submit" class="deny" value="No, Don't Check Out (N)" accesskey="n" />
 </form>
-
 </div></div>
 <!-- /TMPL_IF --> <!-- NEEDSCONFIRMATION -->
 
-- 
1.5.6.3




More information about the Koha-patches mailing list