Prevent OPAC renewals if fines are over limit
authorJesse Weaver <pianohacker@gmail.com>
Sun, 26 Jul 2009 12:28:47 +0000 (13:28 +0100)
committerGalen Charlton <gmcharlt@gmail.com>
Sun, 23 Aug 2009 14:13:26 +0000 (10:13 -0400)
This introduces a new system preference, OPACFineNoRenewals, that sets a
limit on the total fines a patron can have before they can no longer
renew their own books. opac-user.pl has been updated to obey this limit.

This work sponsered by East Brunswick Public Library, East Brunswick, NJ USA

Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com>
Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
admin/systempreferences.pl
installer/data/mysql/en/mandatory/sysprefs.sql
installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl
opac/opac-user.pl

index bb73d42..e584c12 100755 (executable)
@@ -165,6 +165,7 @@ $tabsysprefs{AllowNotForLoanOverride}        = "Circulation";
 $tabsysprefs{RenewalPeriodBase}              = "Circulation";
 $tabsysprefs{FilterBeforeOverdueReport}      = "Circulation";
 $tabsysprefs{AllowHoldDateInFuture}          = "Circulation";
+$tabsysprefs{OPACFineNoRenewals}             = "Circulation";
 
 # Staff Client
 $tabsysprefs{TemplateEncoding}        = "StaffClient";
index 1921948..b7dd846 100644 (file)
@@ -250,3 +250,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','See:  http://aws.amazon.com.  Note that this is required after 2009/08/15 in order to retrieve any enhanced content other than book covers from Amazon.','','free');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','100','Fine Limit above which user canmot renew books via OPAC','','Integer');
index d08415f..ef148d5 100644 (file)
@@ -252,3 +252,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '<itemcallnumber><copynumber>', '30|10', 'This preference defines the format for the quick spine label printer. Just list the fields you would like to see in the order you would like to see them, surrounded by <>, for example <itemcallnumber>.', 'Textarea');
 INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelAutoPrint', '0', '', 'If this setting is turned on, a print dialog will automatically pop up for the quick spine label printer.', 'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('AWSPrivateKey','','Voir:  http://aws.amazon.com. Notez que cela est nécessaire après le 15 Aout 2009 pour pouvoir utiliser les webservices Amazon autre que les couvertures de livre.','','free');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','100','amende limite ci-dessus le lecteur ne peut pas renouveler par l\'OPAC','','Integer');
index f81acaa..6d4f665 100755 (executable)
@@ -2503,6 +2503,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
     print "Upgrade to $DBversion done (added AWSPrivateKey syspref - note that if you use enhanced content from Amazon, this should be set right away.)";
 }
 
+$DBversion = '3.01.00.042';
+if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
+    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACFineNoRenewals','100','Fine Limit above which user canmot renew books via OPAC','','Integer')");
+    SetVersion ($DBversion);
+    print "Upgrade to $DBversion done (added OPACFineNoRenewals syspref)\n";
+}
+
 =item DropAllForeignKeys($table)
 
   Drop all foreign keys of the table $table
index 3e5c19d..3ae68e5 100644 (file)
@@ -98,6 +98,9 @@ $.tablesorter.addParser({
             <!-- TMPL_IF NAME="lost" -->
                 <li><strong>Please note: </strong> Your library card has been marked as lost or stolen. If this is an error, please take your card to the circulation desk at your local library and the error will be corrected.</li>
             <!-- /TMPL_IF -->
+            <!-- TMPL_IF NAME="renewal_blocked_fines" -->
+                <li><strong>Please note: </strong> Since you have <a href="/cgi-bin/koha/opac-account.pl">more than <!-- TMPL_VAR NAME="renewal_blocked_fines" --></a> in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.</li>
+            <!-- /TMPL_IF -->
         </ul></div>
         <!-- /TMPL_IF -->
         
index e1f5aaf..c411c07 100755 (executable)
@@ -74,6 +74,14 @@ if ( $borr->{'amountoutstanding'} > 5 ) {
 if ( 5 >= $borr->{'amountoutstanding'} && $borr->{'amountoutstanding'} > 0 ) {
     $borr->{'amountoverzero'} = 1;
 }
+
+if ( $borr->{'amountoutstanding'} > C4::Context->preference( 'OPACFineNoRenewals' ) ) {
+    $borr->{'flagged'} = 1;
+    $template->param(
+        renewal_blocked_fines => sprintf( "%.02f", C4::Context->preference( 'OPACFineNoRenewals' ) ),
+    );
+}
+
 if ( $borr->{'amountoutstanding'} < 0 ) {
     $borr->{'amountlessthanzero'} = 1;
     $borr->{'amountoutstanding'} = -1 * ( $borr->{'amountoutstanding'} );