Bug 24266: (alternate patch) Only use defined borrowernumbers in reconcile_balances.pl cron

I believe the error is triggered when borrowernumbers are left empty in
the accountlines table. Not sure why this would happen, but it appears
to be what causes the problem.

Do not apply the first patch if testing this patch.

To test:
1) sudo koha-mysql INSTANCENAME
2) Create a test borrower, add any payment etc to create an accountline,
    then delete this borrower
3) ensure the AccountAutoReconcile syspref is disabled
4) Go to another borrower's accounting tab
5) Create a manual credit or debit. Confirm this shows in the 'Make a
payment' tab as an amount that COULD be applied, but isn't automatically
applied
6) in your terminal, run the reconcile_balances.pl script
7) Confirm the error does not show in the logs and the balance for
the borrower is correctly reconciled.

Sponsored-by: Horowhenua District Council
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Aleisha Amohia 2020-03-16 22:09:51 +00:00 committed by Martin Renvoize
parent 04e4656cd2
commit f406aa2ae3
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 2 additions and 1 deletions

View File

@ -81,7 +81,8 @@ cronlogaction();
my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search(
{
amountoutstanding => { '<' => 0 }
amountoutstanding => { '<' => 0 },
borrowernumber => { '!=' => undef }
},
{
columns => [ qw/borrowernumber/ ],