@@ -, +, @@ the previous value of maxoutstanding. This attempt should succeed. This attempt should fail --- C4/SIP/ILS/Patron.pm | 2 +- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/circulation.pref | 2 +- opac/opac-reserve.pl | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) --- a/C4/SIP/ILS/Patron.pm +++ a/C4/SIP/ILS/Patron.pm @@ -349,7 +349,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 { --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -179,7 +179,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'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8083,6 +8083,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.15.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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref @@ -260,7 +260,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.' - --- a/opac/opac-reserve.pl +++ a/opac/opac-reserve.pl @@ -285,9 +285,9 @@ 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 $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; --