From be0d4e5464a367bab0f244659f1597bd41900b37 Mon Sep 17 00:00:00 2001 From: Andrew Fuerste Henry Date: Tue, 26 Nov 2024 18:23:14 +0000 Subject: [PATCH] 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 Signed-off-by: David Nind --- circ/circulation.pl | 7 +++++-- .../intranet-tmpl/prog/en/includes/patron_messages.inc | 2 +- members/moremember.pl | 8 ++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index e7732bfdc7..034a6a6969 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -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, ); } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index f44fd86929..b5136f02b3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -171,7 +171,7 @@ [% END %] [% IF ( credits ) %] -
  • Credits: Patron has a credit[% IF ( creditsamount ) %]of [% creditsamount | $Price %][% END %]
  • +
  • Credits: Patron has outstanding credits[% IF ( creditsamount ) %]of [% creditsamount | $Price %][% END %]
  • [% END %] [% IF (noissues && CAN_user_circulate_force_checkout && !moremember) %]
  • diff --git a/members/moremember.pl b/members/moremember.pl index d08cef77a0..08c2f1a582 100755 --- a/members/moremember.pl +++ b/members/moremember.pl @@ -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, ); } -- 2.39.5