From f8a43317b1c6c40497e0fc986ce8a249ae4be87a Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Sun, 26 Jul 2009 13:28:47 +0100 Subject: [PATCH] Prevent OPAC renewals if fines are over limit 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 Signed-off-by: Galen Charlton --- admin/systempreferences.pl | 1 + installer/data/mysql/en/mandatory/sysprefs.sql | 1 + .../fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl | 3 +++ opac/opac-user.pl | 8 ++++++++ 6 files changed, 21 insertions(+) diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl index bb73d42fd9..e584c124a6 100755 --- a/admin/systempreferences.pl +++ b/admin/systempreferences.pl @@ -165,6 +165,7 @@ $tabsysprefs{AllowNotForLoanOverride} = "Circulation"; $tabsysprefs{RenewalPeriodBase} = "Circulation"; $tabsysprefs{FilterBeforeOverdueReport} = "Circulation"; $tabsysprefs{AllowHoldDateInFuture} = "Circulation"; +$tabsysprefs{OPACFineNoRenewals} = "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 1921948a3c..b7dd84663a 100644 --- a/installer/data/mysql/en/mandatory/sysprefs.sql +++ b/installer/data/mysql/en/mandatory/sysprefs.sql @@ -250,3 +250,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '', '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 .', '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'); diff --git a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql index d08415f01e..ef148d557a 100644 --- a/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql +++ b/installer/data/mysql/fr-FR/1-Obligatoire/unimarc_standard_systemprefs.sql @@ -252,3 +252,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type)VALUES('F INSERT INTO systempreferences (variable,value,options,explanation,type)VALUES('SpineLabelFormat', '', '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 .', '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'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f81acaa7bc..6d4f665be4 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -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 diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl index 3e5c19d7e5..3ae68e5b2a 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-user.tmpl @@ -98,6 +98,9 @@ $.tablesorter.addParser({
  • Please note: 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.
  • + +
  • Please note: Since you have more than in fines, you cannot renew your books online. Please pay your fines if you wish to renew your books.
  • + diff --git a/opac/opac-user.pl b/opac/opac-user.pl index e1f5aaf8e7..c411c07b0c 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -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'} ); -- 2.39.5