Bug 38532: Show both debits and credits on patron's check out and details pages

To test:
1: Have patrons with a variety of credit/debit combinations
2: Confirm Koha shows the total debit amount in patron_messages if any debits exist
3: Confirm Koha does not show anything about creditd in patron_messages if any debits exist
4: Apply patch, restart_all
5: Confirm all patrons show both debit total and credit total

Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Andrew Fuerste Henry 2024-11-26 18:23:14 +00:00 committed by Katrin Fischer
parent 0fcb3b5bb6
commit 337ef11cb3
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
3 changed files with 12 additions and 5 deletions

View File

@ -627,6 +627,8 @@ if ($patron) {
$template->param( is_anonymous => 1 );
$noissues = 1;
}
my $lines = Koha::Account::Lines->search( { borrowernumber => $patron->id } );
my $credits_balance = $lines->credits_total;
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
if ( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
my $noissuescharge =
@ -637,10 +639,11 @@ if ($patron) {
charges => 1,
chargesamount => $patron_charge_limits->{noissuescharge}->{charge},
);
} elsif ( $balance < 0 ) {
}
if ( $credits_balance < 0 ) {
$template->param(
credits => 1,
creditsamount => -$balance,
creditsamount => -$credits_balance,
);
}

View File

@ -171,7 +171,7 @@
[% END %]
[% IF ( credits ) %]
<li class="credits"> <span class="circ-hlt">Credits:</span> Patron has a credit[% IF ( creditsamount ) %]of <span class="credit"><strong>[% creditsamount | $Price %]</strong></span>[% END %] </li>
<li class="credits"> <span class="circ-hlt">Credits:</span> Patron has outstanding credits[% IF ( creditsamount ) %]of <span class="credit"><strong>[% creditsamount | $Price %]</strong></span>[% END %] </li>
[% END %]
[% IF (noissues && CAN_user_circulate_force_checkout && !moremember) %]
<li>

View File

@ -238,16 +238,20 @@ my $issues = $patron->checkouts;
my $balance = 0;
$balance = $patron->account->balance;
my $lines = Koha::Account::Lines->search( { borrowernumber => $patron->id } );
my $credits_balance = $lines->credits_total;
my $patron_charge_limits = $patron->is_patron_inside_charge_limits();
if ( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
$template->param(
charges => 1,
chargesamount => $patron_charge_limits->{noissuescharge}->{charge},
);
} elsif ( $balance < 0 ) {
}
if ( $credits_balance < 0 ) {
$template->param(
credits => 1,
creditsamount => -$balance,
creditsamount => -$credits_balance,
);
}