From 09cc777e472562f60e4643a9b44900e4a7b2871a 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 da4290b..21f06ce 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -329,7 +329,7 @@ sub excessive_fines { sub holds_blocked_by_excessive_fees { 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 e3c0f3d..97b1269 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -56,7 +56,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES -- INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('marcflavour','MARC21','Define global MARC flavor (MARC21 or UNIMARC) used for character encoding','MARC21|UNIMARC','Choice'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('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'); -INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer'); +INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('FeesBlockHoldsAmount',5,'maximum amount withstanding to be able make holds','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxreserves',50,'Define maximum number of holds a patron can place','','Integer'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsInSearchResults',20,'Specify the maximum number of items to display for each result on a page of results',NULL,'free'); INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('memberofinstitution',0,'If ON, patrons can be linked to institutions',NULL,'YesNo'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ebb195c..6da97ed 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7058,6 +7058,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.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 c286ed1..53cf04f 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 @@ -241,7 +241,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 be72e84..26814db 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.1.2