Bugzilla – Attachment 96484 Details for
Bug 24266
Noisy error in reconcile_balances.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24266: Don't search for patrons if no borrowernumbers
Bug-24266-Dont-search-for-patrons-if-no-borrowernu.patch (text/plain), 3.28 KB, created by
Tomás Cohen Arazi
on 2019-12-19 12:55:05 UTC
(
hide
)
Description:
Bug 24266: Don't search for patrons if no borrowernumbers
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2019-12-19 12:55:05 UTC
Size:
3.28 KB
patch
obsolete
>From 0b5e599936ac1c613448806f570689df3e99b447 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 19 Dec 2019 09:52:01 -0300 >Subject: [PATCH] Bug 24266: Don't search for patrons if no borrowernumbers > >This patch makes the reconcile_balances.pl script skip searching for >patrons from a given borrowernumbers list, if the list is empty. > >The code was logically incorrect, and it doesn't break because of a bug >in SQL::Abstract that in recent versions started raising a noisy >warning. > >I couldn't reproduce it in koha-testing-docker but it's been found in >the wild. I submit this obvious fix so people having the issue can test >it properly. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/cronjobs/reconcile_balances.pl | 39 ++++++++++++++++------------- > 1 file changed, 21 insertions(+), 18 deletions(-) > >diff --git a/misc/cronjobs/reconcile_balances.pl b/misc/cronjobs/reconcile_balances.pl >index 0dcae6cb13..f365cca1a2 100755 >--- a/misc/cronjobs/reconcile_balances.pl >+++ b/misc/cronjobs/reconcile_balances.pl >@@ -89,31 +89,34 @@ my @patron_ids = map { $_->borrowernumber } Koha::Account::Lines->search( > } > ); > >-my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } }); >+if ( scalar @patron_ids ) { > >-while (my $patron = $patrons->next) { >+ my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } }); > >- my $account = $patron->account; >- my $total_outstanding_credit = $account->outstanding_credits->total_outstanding; >- my $total_outstanding_debit = $account->outstanding_debits->total_outstanding; >+ while (my $patron = $patrons->next) { > >- if ( $total_outstanding_credit < 0 >- and $total_outstanding_debit > 0) { >+ my $account = $patron->account; >+ my $total_outstanding_credit = $account->outstanding_credits->total_outstanding; >+ my $total_outstanding_debit = $account->outstanding_debits->total_outstanding; > >- try { >+ if ( $total_outstanding_credit < 0 >+ and $total_outstanding_debit > 0) { > >- $account->reconcile_balance; >+ try { > >- print $patron->id . ": credit: $total_outstanding_credit " . >- "debit: $total_outstanding_debit " . >- "=> outstanding " . >- "credit: " . $account->outstanding_credits->total_outstanding . >- " debit: " . $account->outstanding_debits->total_outstanding . "\n" >- if $verbose; >+ $account->reconcile_balance; >+ >+ print $patron->id . ": credit: $total_outstanding_credit " . >+ "debit: $total_outstanding_debit " . >+ "=> outstanding " . >+ "credit: " . $account->outstanding_credits->total_outstanding . >+ " debit: " . $account->outstanding_debits->total_outstanding . "\n" >+ if $verbose; >+ } >+ catch { >+ print "Problem with patron " . $patron->borrowernumber . ": $_"; >+ }; > } >- catch { >- print "Problem with patron " . $patron->borrowernumber . ": $_"; >- }; > } > } > >-- >2.24.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 24266
:
96484
|
100832
|
100926
|
102553
|
102680