Bug 38532: (follow-up) Use Koha::Patron->account methods
Update the patch to use Koha::Account and it's associated 'outstanding' methods to ensure we accurately portray outstanding amounts rather than 'all credits' totals. I also remove the unused `$balance` variable from the members/moremember.pl controller. 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:
parent
337ef11cb3
commit
6b66e4e309
|
|
@ -627,8 +627,7 @@ 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 =
|
||||
|
|
@ -640,6 +639,8 @@ if ($patron) {
|
|||
chargesamount => $patron_charge_limits->{noissuescharge}->{charge},
|
||||
);
|
||||
}
|
||||
|
||||
my $credits_balance = $patron->account->outstanding_credits->total_outstanding;
|
||||
if ( $credits_balance < 0 ) {
|
||||
$template->param(
|
||||
credits => 1,
|
||||
|
|
|
|||
|
|
@ -235,12 +235,6 @@ if ( $patron->has_overdues ) {
|
|||
}
|
||||
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(
|
||||
|
|
@ -248,6 +242,8 @@ if ( $patron_charge_limits->{noissuescharge}->{charge} > 0 ) {
|
|||
chargesamount => $patron_charge_limits->{noissuescharge}->{charge},
|
||||
);
|
||||
}
|
||||
|
||||
my $credits_balance = $patron->account->outstanding_credits->total_outstanding;
|
||||
if ( $credits_balance < 0 ) {
|
||||
$template->param(
|
||||
credits => 1,
|
||||
|
|
|
|||
Loading…
Reference in New Issue