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

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Fri Jan 2 16:55:32 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                                  |    6 +++++-
 circ/circulation.pl                                |    5 +++++
 .../prog/en/modules/circ/circulation.tmpl          |   16 +++++++++++++++-
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index d3ea550..b087314 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -713,7 +713,11 @@ sub CanBookBeIssued {
     if (   $item->{'notforloan'}
         && $item->{'notforloan'} > 0 )
     {
-        $issuingimpossible{NOT_FOR_LOAN} = 1;
+        if(C4::Context->preference("AllowNotForLoanForcing")){
+            $issuingimpossible{NOT_FOR_LOAN_CAN_FORCE} = 1;
+        }else{
+            $issuingimpossible{NOT_FOR_LOAN} = 1;
+        }
     }
 	elsif ( !$item->{'notforloan'} ){
 		# we have to check itemtypes.notforloan also
diff --git a/circ/circulation.pl b/circ/circulation.pl
index 9aa6e57..afe090b 100755
--- a/circ/circulation.pl
+++ b/circ/circulation.pl
@@ -269,6 +269,11 @@ if ($barcode) {
         $inprocess = 1;
     }
   elsif ($issueconfirmed){	# FIXME: Do something? Or is this to *intentionally* do nothing?
+    if (C4::Context->preference("AllowNotForLoanForcing")){
+        AddIssue( $borrower, $barcode, $datedue, $cancelreserve );
+        $template->param(IMPOSSIBLE  => 0);
+        $inprocess = 1;
+    }
   }
   else {
         my $noquestion = 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 f2227d8..2c8628d 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -144,13 +144,27 @@ $.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 -->
 
         <!-- TMPL_IF NAME="IMPOSSIBLE" -->
 <div class="yui-g">
 <div id="circ_impossible" class="dialog alert">
+        <!-- TMPL_IF NAME="NOT_FOR_LOAN_CAN_FORCE" -->
+            <form action="/cgi-bin/koha/circ/circulation.pl" method="post">
+                    <h3>Not for loan</h3>
+                    <p>Item not for loan, are you sure you want to loan it?</p>
+                    <input type="hidden" name="barcode" value="<!-- TMPL_VAR NAME="barcode" -->" />
+                    <input type="hidden" name="borrowernumber" value="<!-- TMPL_VAR NAME="borrowernumber" -->" />
+                    <input type="hidden" name="issueconfirmed" value="1" />
+                    <input type="submit" class="approve" value="Yes, Check Out (Y)" accesskey="y" />
+            </form>
+            <form method="get" action="/cgi-bin/koha/circ/circulation.pl">
+                <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>
+        <!-- /TMPL_IF -->
+
 <!-- RESULT OF ISSUING REQUEST -->
         <ul>
         <!-- TMPL_IF NAME="STATS" -->
-- 
1.5.6.3




More information about the Koha-patches mailing list