From 1144e0a03667f095ad2c0fd7f977d7cae75691df Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 30 Nov 2018 09:54:56 -0300 Subject: [PATCH] Bug 21915: Call reconcile_balance on manual credit creation This patch makes the manual credit creation step call Koha::Account::reconcile_balance when the AccountAutoReconcile syspref is set. To test: - Apply the patch - Have some outstanding debits - Create a manual credit => SUCCESS: Same behaviour as always - Set AccountAutoReconcile - Create a manual credit => SUCCESS: Reconcillation happened - Sign off :-D Signed-off-by: Kyle M Hall --- members/mancredit.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/members/mancredit.pl b/members/mancredit.pl index 5000fb2f85..fe73492543 100755 --- a/members/mancredit.pl +++ b/members/mancredit.pl @@ -81,7 +81,8 @@ if ($add){ my $amount = $input->param('amount') || 0; my $type = $input->param('type'); - $patron->account->add_credit({ + my $account = $patron->account; + $account->add_credit({ amount => $amount, description => $description, item_id => $item_id, @@ -90,6 +91,10 @@ if ($add){ user_id => $logged_in_user->id }); + if ( C4::Context->preference('AccountAutoReconcile') ) { + $account->reconcile_balance; + } + print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber"); } else { -- 2.17.2 (Apple Git-113)