From fdbd701c8288345ec51b0432fd2e26c5726ff3ff Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 28 Apr 2021 14:36:27 +0100 Subject: [PATCH] Bug 27636: (QA follow-up) Restore force AutoReconcile This patch restores the behaviour ->pay always acting as though `AccountAutoReconcile` was enabled. Signed-off-by: Martin Renvoize --- Koha/Account.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index 16bff39073..7551da5c2c 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -86,7 +86,6 @@ sub pay { my $userenv = C4::Context->userenv; - my $manager_id = $userenv ? $userenv->{number} : undef; my $interface = $params ? ( $params->{interface} || C4::Context->interface ) : C4::Context->interface; my $payment = $self->payin_amount( @@ -105,6 +104,10 @@ sub pay { } ); + # NOTE: Pay historically always applied as much credit as it could to all + # existing outstanding debits, whether passed specific debits or otherwise. + $payment = $payment->apply( { debits => $self->outstanding_debits->as_list } ); + my $patron = Koha::Patrons->find( $self->{patron_id} ); my @account_offsets = $payment->debit_offsets; if ( C4::Context->preference('UseEmailReceipts') ) { -- 2.20.1