[Koha-patches] [PATCH] Bug 4405 - Overdues block check out

Chris Cormack chrisc at catalyst.net.nz
Mon Apr 26 00:30:55 CEST 2010


Squashed commit of the following:

commit 6a1f66e0686a14d8a89abfc3fe5978dabd0b7af7
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Mon Apr 26 10:27:39 2010 +1200

    Tidy up ready to send patch

commit 4d1398df18dcce4fd888cf17a0e2955fdf6ee1e4
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Mon Apr 26 10:26:15 2010 +1200

    Bug 4405 - tidy up

commit 3daeb71bc6b690e18dda96aa3c767c2bb0521038
Author: Chris Cormack <chrisc at catalyst.net.nz>
Date:   Mon Apr 26 10:02:04 2010 +1200

    Bug 4405 - Overdues block checkout
---
 C4/Circulation.pm                                  |    9 +++++++--
 admin/systempreferences.pl                         |    2 ++
 installer/data/mysql/en/mandatory/sysprefs.sql     |    1 +
 installer/data/mysql/updatedatabase.pl             |    7 +++++++
 .../en/modules/admin/preferences/circulation.pref  |    7 +++++++
 .../prog/en/modules/circ/circulation.tmpl          |    4 ++++
 kohaversion.pl                                     |    2 +-
 7 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/C4/Circulation.pm b/C4/Circulation.pm
index 77650a0..1c042ef 100644
--- a/C4/Circulation.pm
+++ b/C4/Circulation.pm
@@ -733,8 +733,13 @@ sub CanBookBeIssued {
 
     my ($blocktype, $count) = C4::Members::IsMemberBlocked($borrower->{'borrowernumber'});
     if($blocktype == -1){
-        ## remaining overdue documents
-        $issuingimpossible{USERBLOCKEDREMAINING} = $count;
+        ## remaining overdue documentsi
+	if ( C4::Context->preference("OverduesBlockCirc") eq 'block'){
+	    $issuingimpossible{USERBLOCKEDREMAINING} = $count;
+	}
+	elsif ( C4::Context->preference("OverudesBlockCirc") eq 'confirmation'){
+	    $needsconfirmation{USERBLOCKEDREMAINING} = $count;
+	}
     }elsif($blocktype == 1){
         ## blocked because of overdue return
         $issuingimpossible{USERBLOCKEDOVERDUE} = $count;
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index 6739cd9..b39a922 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -179,6 +179,8 @@ $tabsysprefs{ReturnToShelvingCart}           = "Circulation";
 $tabsysprefs{DisplayClearScreenButton}       = "Circulation";
 $tabsysprefs{AllowAllMessageDeletion}        = "Circulation";
 $tabsysprefs{OverdueNoticeBcc}               = "Circulation";
+$tabsysprefs{OverduesBlockCirc}              = "Circulation";
+
 
 # Staff Client
 $tabsysprefs{TemplateEncoding}        = "StaffClient";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index a9d437b..8601358 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -286,3 +286,4 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` ( `variable` , `value` , `options` , `explanation` , `type` ) VALUES ( 'PrintNoticesMaxLines', '0', '', 'If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.', 'Integer' );
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI','0','Enables ILS-DI services at OPAC.','','YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ILS-DI:Authorized_IPs','','.','Restricts usage of ILS-DI to some IPs','Free');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OverduesBlockCirc','no','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','noblock|confirmation|block','Choice');
\ No newline at end of file
diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl
index eb364d3..201e30c 100755
--- a/installer/data/mysql/updatedatabase.pl
+++ b/installer/data/mysql/updatedatabase.pl
@@ -3555,6 +3555,13 @@ if (C4::Context->preference('Version') < TransformToNum($DBversion)){
     SetVersion ($DBversion);
 }
 
+$DBversion = '3.01.00.XXX';
+if (C4::Context->preference('Version') < TransformToNum($DBversion)){
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES ('OverduesBlockCirc','no','When checking out an item should overdues block checkout, generate a confirmation dialogue, or allow checkout','noblock|confirmation|block','Choice')");
+    print "Upgrade to $DBversion done (bug 4405: Circulation is blocked if a borrower has overdues)\n";
+    SetVersion ($DBversion);
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
index a17be02..8c7bcc0 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref
@@ -185,6 +185,13 @@ Circulation:
             - pref: PrintNoticesMaxLines
               class: integer
             - "item lines in a printed overdue notice. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.  Set to 0 to include all overdue items in the notice, no matter how many there are."
+        -
+            - pref: OverduesBlockCirc
+              choices:
+                  block: Block
+                  noblock: "Don't block"
+                  confirmatio: Ask for confirmation
+            - when checking out to a borrower that has overdues outstanding	    
     Holds Policy:
         -
             - pref: AllowHoldPolicyOverride
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 d7a70fe..92b89a1 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tmpl
@@ -337,6 +337,10 @@ function refocus(calendar) {
         <!-- TMPL_IF NAME="NOTSAMEBRANCH" -->
             <li>This item belongs to <!-- TMPL_VAR NAME="itemhomebranch" --> and cannot be issued from this location.</li>
         <!-- /TMPL_IF -->
+	
+	<!-- TMPL_IF NAME="USERBLOCKEDREMAINING" --:
+	    <li>Check out blocked as borrower has overdues outstanding</li>
+	<!-- /TMPL_IF -->
         </ul>
 
     <!-- TMPL_IF NAME="memberofinstution" -->
diff --git a/kohaversion.pl b/kohaversion.pl
index 52efaa0..ce483ee 100644
--- a/kohaversion.pl
+++ b/kohaversion.pl
@@ -10,7 +10,7 @@
 use strict;
 
 sub kohaversion {
-    our $VERSION = '3.01.00.128';
+    our $VERSION = '3.01.00.XXX';
     # version needs to be set this way
     # so that it can be picked up by Makefile.PL
     # during install
-- 
1.6.3.3




More information about the Koha-patches mailing list