[Bug 24266] New: Noisy error in reconcile_balances.pl
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Bug ID: 24266 Summary: Noisy error in reconcile_balances.pl Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: wizzyrea@gmail.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz Cron <instance-koha@kohaMain> $KOHA_CRON_PATH/reconcile_balances.pl --verbose Gives this message when run: SQL::Abstract::puke(): [SQL::Abstract::__ANON__] Fatal: SQL::Abstract before v1.75 used to generate incorrect SQL when the -IN operator was given an undef-containing list: !!!AUDIT YOUR CODE AND DATA!!! (the upcoming Data::Query-based version of SQL::Abstract will emit the logically correct SQL instead of raising this exception) at /usr/share/koha/lib/Koha/Objects.pm line 209 It would be nice if this wouldn't happen, so that cron doesn't send mails about this error. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Depends on| |21915 --- Comment #1 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Hi Liz, I do not recreate. How do you? I tried the 2 situations: - patron has one accountline with amountoutstanding < 0 - nothing in the accountlines table My understanding of the error is that 92 my $patrons = Koha::Patrons->search({ borrowernumber => { -in => \@patron_ids } }); is called with @patron_ids = ( undef ); Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21915 [Bug 21915] Add a way to automatically reconcile balance for patrons -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com --- Comment #2 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I cannot reproduce either, but I agree the code needs to be fixed. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #3 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- (In reply to Tomás Cohen Arazi from comment #2)
I cannot reproduce either, but I agree the code needs to be fixed.
It's not. It should never be (undef) -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #4 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 96484 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=96484&action=edit 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> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Status|NEW |Needs Signoff --- Comment #5 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Liz, please test it on your production site and let me know if it fixes the issue. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #6 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Tomas, the warning is about ->search({ -in => [undef] }), not ->search({ -in => [] }). So I do not think your patch will change anything. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #7 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 100832 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100832&action=edit 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) if you don't have any accountlines where the borrowernumber is null, update one of your accountlines where the amountoutstanding is more than zero, and make the borrowernumber NULL 3) ensure the AccountAutoReconcile syspref is disabled 4) Go to [borrowernumber]'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 [borrowernumber] is correctly reconciled. Sponsored-by: Horowhenua District Council -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |aleisha@catalyst.net.nz Change sponsored?|--- |Sponsored Assignee|tomascohen@gmail.com |aleisha@catalyst.net.nz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #8 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I totally forgot about this one. Sorry. Borrowernumbers get emptied when the patron gets deleted. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #9 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Ah that totally makes sense. Perhaps instead of going into the database in the test plan, create a test borrower, add some accountline, then delete the borrower. The script should know to skip past them. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #10 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Aleisha, double check your patch, you have "1=" instead of "!=" -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #100832|0 |1 is obsolete| | --- Comment #11 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 100926 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=100926&action=edit 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 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Fridolin SOMERS <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #12 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- alternate patch ? Its more a follow-up no ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #13 from Aleisha Amohia <aleisha@catalyst.net.nz> --- (In reply to Fridolin SOMERS from comment #12)
alternate patch ? Its more a follow-up no ?
Alternate patch, because in Comment 6 it was mentioned that the first patch doesn't really fix the problem -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #14 from Fridolin SOMERS <fridolin.somers@biblibre.com> --- (In reply to Aleisha Amohia from comment #13)
(In reply to Fridolin SOMERS from comment #12)
alternate patch ? Its more a follow-up no ?
Alternate patch, because in Comment 6 it was mentioned that the first patch doesn't really fix the problem
Ah in this case set it obsolete or set status In Discussion :) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #96484|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #15 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Let's try Aleisha patch and see if it fixes the original issue. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #100926|0 |1 is obsolete| | --- Comment #16 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 102553 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102553&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |martin.renvoize@ptfs-europe | |.com --- Comment #17 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- This appears to resolve the issue for me.. Signing off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #102553|0 |1 is obsolete| | --- Comment #18 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 102680 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=102680&action=edit 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> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |m.de.rooy@rijksmuseum.nl |y.org | CC| |m.de.rooy@rijksmuseum.nl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 --- Comment #19 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #20 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- *** Bug 25148 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to master |Pushed to stable CC| |joy@bywatersolutions.com Version(s)|20.05.00 |20.05.00, 19.11.06 released in| | --- Comment #21 from Joy Nelson <joy@bywatersolutions.com> --- backported to 19.11.x for 19.11.06 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24266 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.05.00, 19.11.06 |20.05.00, 19.11.06, released in| |19.05.11 Status|Pushed to stable |Pushed to oldstable CC| |lucas@bywatersolutions.com --- Comment #22 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 19.05.x. for 19.05.11 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org