From 402599b202d7c359dd4b553f40e7297100645cd0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 11 Jun 2013 10:18:16 -0400 Subject: [PATCH] Bug 10446 - System preference maxoutstanding is poorly named The system preference 'maxoutstanding' is defined as the maximum amount of fees owed by the patron before Koha should block placing holds, but the name does not describe its behavior very well. String changes only, no functional changes made. Test Plan: 1) Apply patch 2) Run updatedatabase.pl 3) Verify the new system preference FeesBlockHoldsAmount's value matches the previous value of maxoutstanding. 4) Set FeesBlockHoldsAmount to $10 5) Attempt to place an OPAC hold for a patron owing less than $10 This attempt should succeed. 6) Attempt to place an OPAC hold for a patron owing more than $10 This attempt should fail Signed-off-by: Srdjan --- C4/SIP/ILS/Patron.pm | 2 +- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 8 ++++++++ .../en/modules/admin/preferences/circulation.pref | 2 +- opac/opac-reserve.pl | 8 ++++---- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index d326f89..d5032f2 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -351,7 +351,7 @@ sub excessive_fines { sub holds_blocked_by_excessive_fees { my $self = shift; return ( $self->fee_amount - && $self->fee_amount > C4::Context->preference("maxoutstanding") ); + && $self->fee_amount > C4::Context->preference("FeesBlockHoldsAmount") ); } sub library_name { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 600279d..b93df16 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -189,7 +189,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'), ('MaxItemsForBatch','1000',NULL,'Max number of items record to process in a batch (modification or deletion)','Integer'), ('maxItemsInSearchResults','20',NULL,'Specify the maximum number of items to display for each result on a page of results','free'), -('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'), +('FeesBlockHoldsAmount','5','','maximum amount withstanding to be able make holds','Integer'), ('maxRecordsForFacets','20',NULL,NULL,'Integer'), ('maxreserves','50','','Define maximum number of holds a patron can place','Integer'), ('minPasswordLength','3',NULL,'Specify the minimum length of a patron/staff password','free'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index e1fb8be..d5f5b7f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -8845,6 +8845,14 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("UPDATE systempreferences SET variable = 'FeesBlockHoldsAmount' WHERE variable = 'maxoutstanding'"); + print "Upgrade to $DBversion done (Bug 10446 - System preference maxoutstanding is poorly named)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($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 2190004..fddd4df 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 @@ -267,7 +267,7 @@ Circulation: - a renewal notice according to patron checkout alert preferences. - - Prevent patrons from making holds on the OPAC if they owe more than - - pref: maxoutstanding + - pref: FeesBlockHoldsAmount class: currency - '[% local_currency %] in fines.' - diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 45d03bd..0495365 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -298,10 +298,10 @@ if ( $query->param('place_reserve') ) { # # my $noreserves = 0; -my $maxoutstanding = C4::Context->preference("maxoutstanding"); -$template->param( noreserve => 1 ) unless $maxoutstanding; -if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $maxoutstanding) ) { - my $amount = sprintf "%.02f", $borr->{'amountoutstanding'}; +my $FeesBlockHoldsAmount = C4::Context->preference("FeesBlockHoldsAmount"); +$template->param( noreserve => 1 ) unless $FeesBlockHoldsAmount; +if ( $borr->{'amountoutstanding'} && ($borr->{'amountoutstanding'} > $FeesBlockHoldsAmount) ) { + my $amount = sprintf "\$%.02f", $borr->{'amountoutstanding'}; $template->param( message => 1 ); $noreserves = 1; $template->param( too_much_oweing => $amount ); -- 1.7.9.5