From 2c27b882c83f4c0b13be59e69b520d34f8c75cc4 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 | 7 +++++++ .../prog/en/modules/admin/preferences/circulation.pref | 2 +- opac/opac-reserve.pl | 6 +++--- 5 files changed, 13 insertions(+), 6 deletions(-) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index 4ccd21b..215bdd0 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/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 { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 661910b..8928625 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/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'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 062ecc1..91be545 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/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) 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 70ac352..1d3106f 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 @@ -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.' - diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 6d5d46f..e76853b 100755 --- a/opac/opac-reserve.pl +++ b/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; -- 1.8.3.2