Bug 29115: Fix syntax errors in club hold functionality

The code didn't previously correctly do the checks for patron
debarment status and whether the patron has fees, this caused the
intended warnings messages to not appear when they should have.

To test:
 1) Create a new club and add a patron to it who has manual debarment
    and a manual charge of over $5 (more than the maxoutstanding syspref).
 2) Try to create a new club hold for the previously created club and
    notice no warnings are listed for the patron.
 3) Apply patch
 4) Try to create now the club hold again and notice the warnings
    being shown in the hold page.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit d8c5c195c9)

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
This commit is contained in:
Joonas Kylmälä 2021-09-26 15:36:45 +00:00 committed by Andrew Fuerste-Henry
parent 4a1ff2a414
commit 1bd7d3f2e6
2 changed files with 3 additions and 9 deletions

View File

@ -223,7 +223,7 @@
<strong>Too many holds: </strong> Patron can only place a maximum of [% maxreserves | html %] total holds.
</div>
[% END %]
[% IF ( member.expiry ) %]
[% IF ( patron.is_expired ) %]
<div>
<i class="fa fa-warning"></i>
<strong>Account has expired</strong>
@ -235,7 +235,7 @@
<strong>Patron has restrictions</strong>
</div>
[% END %]
[% IF amount_outstanding && Koha.Preference('maxoutstanding') && amount_outstanding > Koha.Preference('maxoutstanding') %]
[% IF member.amount_outstanding && Koha.Preference('maxoutstanding') && member.amount_outstanding > Koha.Preference('maxoutstanding') %]
<div>
<i class="fa fa-warning"></i>
<strong>Patron has outstanding fines: [% member.amount_outstanding | $Price %]</strong>

View File

@ -242,7 +242,7 @@ if ($club_hold && !$borrowernumber_hold && !$action) {
while(my $enrollment = $enrollments->next) {
next if $enrollment->is_canceled;
my $member = { patron => $enrollment->patron->unblessed };
my $member = { patron => $enrollment->patron };
my $reserves_count = $enrollment->patron->holds->count;
if ( $maxreserves
&& ( $reserves_count + $new_reserves_count > $maxreserves ) )
@ -252,12 +252,6 @@ if ($club_hold && !$borrowernumber_hold && !$action) {
: 0;
$member->{exceeded_maxreserves} = 1;
}
my $expiry_date = $enrollment->patron->dateexpiry;
$member->{expiry} = 0; # flag set if patron account has expired
if ($expiry_date and
Date_to_Days(split /-/,$date) > Date_to_Days(split /-/,$expiry_date)) {
$member->{expiry} = 1;
}
$member->{amount_outstanding} = $enrollment->patron->account->balance;
if ( $enrollment->patron->branchcode ne C4::Context->userenv->{'branch'} ) {
$member->{diffbranch} = 1;