Bug 25220 - maxoutstanding syspref should be disabled by a null value
Summary: maxoutstanding syspref should be disabled by a null value
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Hold requests (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on:
Blocks: 25219
  Show dependency treegraph
 
Reported: 2020-04-20 16:20 UTC by Andrew Fuerste-Henry
Modified: 2022-07-06 21:47 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 25220: maxoutstanding ignored if null in opac-reserve.pl (1.57 KB, patch)
2020-04-21 14:06 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25220: make maxoutstanding set to null not give warning on opac-user.pl (1.17 KB, patch)
2020-04-21 14:06 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25220: atomicupdate to maintain behavior of existing installs (1.30 KB, patch)
2020-04-21 15:41 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 25220: maxoutstanding ignored if null in opac-reserve.pl (1.62 KB, patch)
2020-05-07 12:38 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 25220: make maxoutstanding set to null not give warning on opac-user.pl (1.22 KB, patch)
2020-05-07 12:39 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 25220: atomicupdate to maintain behavior of existing installs (1.44 KB, patch)
2020-05-07 12:39 UTC, Owen Leonard
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2020-04-20 16:20:32 UTC
Several fines-related system preferences (OPACFineNoRenewals, noissuescharge, etc) can be disabled by leaving them blank. But maxoutstanding treats a blank as a zero, blocking OPAC holds for *any* fine balance. 

I'd like this to change to match the functionality of the other sysprefs.

If nothing else, we should add some language to say a blank is treated as a zero.
Comment 1 Andrew Fuerste-Henry 2020-04-20 17:14:04 UTC
To Test:
1) Set maxoutstanding to blank
2) give yourself $0.50 in fines
3) go to opac, confirm you're blocked from placing holds
4) set maxoutstanding=1
5) confirm you are no longer blocked from placing holds
Comment 2 Andrew Fuerste-Henry 2020-04-21 14:06:22 UTC
Created attachment 103377 [details] [review]
Bug 25220: maxoutstanding ignored if null in opac-reserve.pl

To Test:
1) set maxoutstanding to empty
2) give yourself a fine of $1
3) try to place a hold on the opac
4) confirm you cannot place hold
5) apply patch, restart_all
6) reload opac
7) confirm hold is allowed
8) set maxoutstanding to $2
9) confirm hold is now blocked
Comment 3 Andrew Fuerste-Henry 2020-04-21 14:06:25 UTC
Created attachment 103378 [details] [review]
Bug 25220: make maxoutstanding set to null not give warning on opac-user.pl

To test:
1) set maxoutstanding to empty
2) give yourself $1 in fine
3) go to your account on OPAC
4) confirm you have message that holds are blocked
5) apply patch, restart_all
6) reload OPAC
7) confirm message is gone
8) set maxoutstanding to $2
9) reload opac, confirm message is back
Comment 4 Andrew Fuerste-Henry 2020-04-21 14:19:59 UTC
Correcting / consolidating test plan:

To test:
1) set maxoutstanding to empty
2) give yourself $1 in fine
3) go to your account on OPAC
4) confirm you have message that holds are blocked
5) try to place a hold on opac
6) confirm hold is blocked
7) apply patch, restart_all
8) reload OPAC
9) confirm you can now place a hold
10) confirm message on your account is gone
11) set maxoutstanding to $.5
12) reload opac
13) confirm you are blocked from hold
14) confirm message on account is back
Comment 5 Andrew Fuerste-Henry 2020-04-21 15:41:23 UTC
Created attachment 103388 [details] [review]
Bug 25220: atomicupdate to maintain behavior of existing installs

To test:
1) on an existing install, set maxoutstanding to null
2) apply patch
3) confirm maxoutstanding is now set to zero
Comment 6 Owen Leonard 2020-05-07 12:38:57 UTC
Created attachment 104506 [details] [review]
Bug 25220: maxoutstanding ignored if null in opac-reserve.pl

To Test:
1) set maxoutstanding to empty
2) give yourself a fine of $1
3) try to place a hold on the opac
4) confirm you cannot place hold
5) apply patch, restart_all
6) reload opac
7) confirm hold is allowed
8) set maxoutstanding to $2
9) confirm hold is now blocked

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 7 Owen Leonard 2020-05-07 12:39:00 UTC
Created attachment 104507 [details] [review]
Bug 25220: make maxoutstanding set to null not give warning on opac-user.pl

To test:
1) set maxoutstanding to empty
2) give yourself $1 in fine
3) go to your account on OPAC
4) confirm you have message that holds are blocked
5) apply patch, restart_all
6) reload OPAC
7) confirm message is gone
8) set maxoutstanding to $2
9) reload opac, confirm message is back

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 8 Owen Leonard 2020-05-07 12:39:03 UTC
Created attachment 104508 [details] [review]
Bug 25220: atomicupdate to maintain behavior of existing installs

To test:
1) on an existing install, set maxoutstanding to null
2) apply patch
3) confirm maxoutstanding is now set to zero

Amended during signoff: Corrected atomicupdate file extension from .pl
to .perl.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 9 Marcel de Rooy 2020-05-08 09:22:12 UTC
C4/SIP/ILS/Patron.pm:          && $self->fee_amount > C4::Context->preference("maxoutstanding") );
circ/offline.pl:$template->{'VARS'}->{'maxoutstanding'} =
circ/offline.pl:  C4::Context->preference('maxoutstanding') || 0;
installer/data/mysql/atomicupdate/bug_25220.perl:    $dbh->do( "UPDATE systempreferences set value=0 where variable='maxoutstanding' and (value='' or value is null)" );
installer/data/mysql/atomicupdate/bug_25220.perl:    NewVersion( $DBversion, 25220, "maxoutstanding should be disabled by a null value");
installer/data/mysql/sysprefs.sql:('maxoutstanding','5','','maximum amount withstanding to be able make holds','Integer'),
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref:            - pref: maxoutstanding
koha-tmpl/intranet-tmpl/prog/en/modules/circ/offline.tt:                if (parseInt(patron.fine) > [% maxoutstanding | html %]) {
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt:                                    [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt:                [% IF ( expiry || diffbranch || patron.is_debarred || ( amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') ) ) %]
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt:                            [% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]


opac/opac-reserve.pl:my $maxoutstanding = C4::Context->preference("maxoutstanding");
opac/opac-reserve.pl:$maxoutstanding = undef unless looks_like_number($maxoutstanding);
opac/opac-reserve.pl:$template->param( noreserve => 1 ) unless $maxoutstanding;
opac/opac-reserve.pl:if ( $amountoutstanding && defined($maxoutstanding) && ($amountoutstanding > $maxoutstanding) ) {
opac/opac-user.pl:my $maxoutstanding = C4::Context->preference('maxoutstanding');
opac/opac-user.pl:$maxoutstanding = undef unless looks_like_number ( $maxoutstanding );
opac/opac-user.pl:if ( $amountoutstanding && defined($maxoutstanding) && ( $amountoutstanding > $maxoutstanding ) ){

Are you sure that you only needed to change opac-reserve and opac-user ? If I am looking at this git grep, I wouldnt.
Also note that the test Koha.Pref( ) && a > b, looks a bit more elegant, although it could trigger warnings on non-numerical comparison if you wrote "abc" in maxoutstanding. But who would?

+    $dbh->do( "UPDATE systempreferences set value=0 where variable='maxoutstanding' and (value='' or value is null)" );
This does not look good. Value is a text field. You mean '0'? :)
I think we dont need this change. And also you dont correct 'abc'?