You cannot run the script without category, the SQL fails - we should either fix this or note that category is mandatory in the script root@kohadevbox:koha(master)$ perl misc/cronjobs/delete_patrons.pl --expired_before =1910-01-01 C4::Members::GetBorrowersToExpunge(): DBI Exception: DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') GROUP BY borrowers.borrowernumber ) xxx WHERE currentissue IS NULL' at line 12 [for Statement " SELECT * FROM ( SELECT borrowers.borrowernumber, MAX(old_issues.timestamp) AS latestissue, MAX(issues.timestamp) AS currentissue FROM borrowers JOIN categories USING (categorycode) LEFT JOIN ( SELECT guarantor_id FROM borrower_relationships WHERE guarantor_id IS NOT NULL AND guarantor_id <> 0 ) as tmp ON borrowers.borrowernumber=tmp.guarantor_id LEFT JOIN old_issues USING (borrowernumber) LEFT JOIN issues USING (borrowernumber) WHERE category_type <> 'S' AND ( borrowers.flags IS NULL OR borrowers.flags = 0 ) AND tmp.guarantor_id IS NULL AND dateexpiry < ? AND categorycode IN () GROUP BY borrowers.borrowernumber
Is this error triggered if you do a "dry run" (without -c|--confirm)? I have been doing some dry runs on 20.05.08 and I have not seen this error.
(In reply to Magnus Enger from comment #1) > Is this error triggered if you do a "dry run" (without -c|--confirm)? I have > been doing some dry runs on 20.05.08 and I have not seen this error. I believe caused by 27050 - so not affecting 20.05
Created attachment 119363 [details] [review] Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed GetBorrowersToExpunge must not crash if called with an empty patron category list Test plan: Call delete_patrons.pl with and without patron categories. The script must work as expected
Created attachment 119387 [details] [review] Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed GetBorrowersToExpunge must not crash if called with an empty patron category list Test plan: Call delete_patrons.pl with and without patron categories. The script must work as expected Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 119650 [details] [review] Bug 28001: (bug 27050 follow-up) Fix delete_patrons if no category passed GetBorrowersToExpunge must not crash if called with an empty patron category list Test plan: Call delete_patrons.pl with and without patron categories. The script must work as expected Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 119651 [details] [review] Bug 28001: (QA follow-up) Clarify messages and indicate test mode
Pushed to master for 21.05, thanks to everybody involved!
Depends on Bug 27050 not in 20.11.x