[Bug 41315] New: Using patron-homelibrary option for overdue notices may not send notices to all branches
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Bug ID: 41315 Summary: Using patron-homelibrary option for overdue notices may not send notices to all branches Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Command-line Utilities Assignee: koha-bugs@lists.koha-community.org Reporter: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org CC: robin@catalyst.net.nz Bug 32740 added the option to send overdue notices from the patron's homelibrary. The branchcode variable is used for several purposes, in the new code: 649 if ($patron_homelibrary) { 650 $branchcode = $patron->branchcode; 651 $library = Koha::Libraries->find($branchcode); 652 $admin_email_address = $library->from_email_address; 653 $branch_email_address = C4::Context->preference('AddressForFailedOverdueNotices') 654 || $library->inbound_email_address; 655 } We change that branchcode param based on the patron, however, earlier when getting the list of patrons we limit by issue branch: 567 my $borrower_sql = <<"END_SQL"; 568 SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due 569 FROM issues,borrowers,categories,items 570 WHERE issues.borrowernumber=borrowers.borrowernumber 571 AND borrowers.categorycode=categories.categorycode 572 AND issues.itemnumber = items.itemnumber 573 AND items.itemlost = 0 574 AND TO_DAYS($date)-TO_DAYS(issues.date_due) >= 0 575 END_SQL 576 my @borrower_parameters; 577 if ($branchcode) { 578 if ($owning_library) { 579 $borrower_sql .= ' AND items.homebranch=? '; 580 } else { 581 $borrower_sql .= ' AND issues.branchcode=? '; 582 } 583 push @borrower_parameters, $branchcode; 584 } So we may have a patron from a different branch when we go through here, and end up changing the branch we will look at during the next pass of the code above I recreated by checking out three items to patrons from different branches, 1 day overdue each: MariaDB [koha_kohadev]> SELECT borrowers.cardnumber, borrowers.surname, borrowers.branchcode, borrowers.categorycode, issues.issue_id, issues.branchcode, issues.date_due FROM issues JOIN borrowers USING (borrowernumber); +----------------+---------+------------+--------------+----------+------------+---------------------+ | cardnumber | surname | branchcode | categorycode | issue_id | branchcode | date_due | +----------------+---------+------------+--------------+----------+------------+---------------------+ | 23529001000463 | Acosta | MPL | PT | 1 | CPL | 2025-11-25 23:59:00 | | 23529000139858 | Ballard | FFL | PT | 2 | CPL | 2025-11-25 23:59:00 | | 23529000035676 | Acevedo | IPT | PT | 3 | CPL | 2025-11-25 23:59:00 | +----------------+---------+------------+--------------+----------+------------+---------------------+ 3 rows in set (0.001 sec) Setting overdue rules to trigger at 1 day, then got this output: branch 'CPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 Found 3 borrowers with overdues borrower Acosta, Edna (5) has items triggering level 1. borrower Acevedo, Henry (19) has items triggering level 1. borrower Ballard, Ronnie (21) has items triggering level 1. branch 'FFL', categorycode = PT pass 2 No letter code found for pass 2 branch 'FFL', categorycode = PT pass 3 No letter code found for pass 3 -- 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=41315 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |32740 Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32740 [Bug 32740] Add a new option patron home library to OverdueNoticeFrom -- 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=41315 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #1 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 189965 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189965&action=edit Bug 41315: Change only notice branchcode when OverDueNoticeFrom is set to patron-homelibrary This patch adds a new variable $notice_branchcode and uses this when getting the patron's homelibrary to ensure we don't change the branch we are using. To test: 1 - At branch A - checkout three items, 1 day overdue to 3 patrons of the same category from different branches (not A) 2 - Set the system preference OverdueNoticeFrom to 'patron home library' 3 - Browse to More->Tools->Overdue notice/status triggers 4 - Set overdue triggers for default library and the category used above to: Delay: 1 Letter: Overdue notice (ODUE) 5 - From the command line run the overdue notices: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 6 - Note that we begin pass 1 with CPL and then use a different branch for passes 2 and 3 7 - Apply patch 8 - Repeat 9 - Confirm branch is consistent 10 - Run without branch param: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 11 - Confirm branches are consistent -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #2 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 189966 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189966&action=edit Bug 41315: Remove unecessary conditional We are in a loop here: foreach my $branchcode (@branches) { branchcode must be defined or something has gone seriously wrong with PERL -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #3 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 189967 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189967&action=edit Bug 41315: (follow-up) Rename statements for clarity -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #4 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 189968 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189968&action=edit Bug 41315: Don't change which branch is used for getting the transports See bug 41316 - the script uses the triggers of the issuing branch when sending by patron library - we shouldn't change this here, but on the next bug -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |41316 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41316 [Bug 41316] Using patron-homelibrary option for overdue notices does not change which rules are used -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Nick Clemens (kidclamp) <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=10190 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Cheryl <clackman@fargolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clackman@fargolibrary.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrew@bywatersolutions.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- I attempted to test, but I don't think I'm seeing what I should see. Happy to test again if you can point out where I may have gone wrong. Before the patch ================= 1. I issued three items at Centerville to patrons from three different libraries in the same patron category - I selected the day before 'Yesterday' for the due date when checking out. 2. The Barcodes for items checked out (all the items are from Centerville): - 39999000001570 - 39999000008975 - 39999000001617 3. The output from the SQL query: MariaDB [koha_kohadev]> SELECT borrowers.cardnumber, borrowers.surname, borrowers.branchcode, borrowers.categorycode, issues.issue_id, issues.branchcode, issues.date_due FROM issues JOIN borrowers USING (borrowernumber); +----------------+---------+------------+--------------+----------+------------+---------------------+ | cardnumber | surname | branchcode | categorycode | issue_id | branchcode | date_due | +----------------+---------+------------+--------------+----------+------------+---------------------+ | 23529000651225 | Burton | MPL | PT | 1 | CPL | 2025-12-24 23:59:00 | | 23529000065863 | Hawkins | SPL | PT | 2 | CPL | 2025-12-24 23:59:00 | | 23529000065863 | Hawkins | SPL | PT | 3 | CPL | 2025-12-24 23:59:00 | +----------------+---------+------------+--------------+----------+------------+---------------------+ 3 rows in set (0.001 sec) 4. For the overdue notice/status triggers: - Select library: Default - Patron category - Patron: . Delay: 1 . Letter: Overdue notice (ODUE) - Nothing else entered 5. Steps 5 and 6: - Output for step 5 - Each pass shows as CPL for me. - Is this right/what is expected? - Step 6 says I should see different branches - in the description for the bug, the output has different library codes for each pass -- pass 1 = CPL, pass 2 = FFL, and pass 3 = FFL: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v Found 12 branches with first message enabled: 'CPL', 'FFL', 'FPL', 'FRL', 'IPT', 'LPL', 'MPL', 'PVL', 'RPL', 'SPL', 'TPL', 'UPL' branch CPL passed on parameter branch CPL have overdue rules ====================================== branchcode : 'CPL' using root@localhost branch 'CPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber CPL | PT (1, 90, 2025-12-26T01:10:19) -------------------------- Found 3 borrowers with overdues branch 'CPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'CPL', categorycode = PT pass 3 No letter code found for pass 3 After the patch =============== Output from step 5 - no change ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v Found 12 branches with first message enabled: 'CPL', 'FFL', 'FPL', 'FRL', 'IPT', 'LPL', 'MPL', 'PVL', 'RPL', 'SPL', 'TPL', 'UPL' branch CPL passed on parameter branch CPL have overdue rules ====================================== branchcode : 'CPL' using root@localhost branch 'CPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber CPL | PT (1, 90, 2025-12-26T01:15:25) -------------------------- Found 3 borrowers with overdues branch 'CPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'CPL', categorycode = PT pass 3 No letter code found for pass 3 Steps 9 and 11 ~~~~~~~~~~~~~~ I'm not sure what is meant by "Confirm branch is consistent". Should it be CPL for each pass?
From the output above, it is the same as before the patch - all showing CPL for for each pass.
Output from step 10 - I removed '--libary CPL' from the command (is that correct?) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ perl misc/cronjobs/overdue_notices.pl --triggered --test --nomail -v -v Found 12 branches with first message enabled: 'CPL', 'FFL', 'FPL', 'FRL', 'IPT', 'LPL', 'MPL', 'PVL', 'RPL', 'SPL', 'TPL', 'UPL' ====================================== branchcode : 'CPL' using root@localhost branch 'CPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber CPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 3 borrowers with overdues branch 'CPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'CPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'FFL' using root@localhost branch 'FFL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber FFL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'FFL', categorycode = PT pass 2 No letter code found for pass 2 branch 'FFL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'FPL' using root@localhost branch 'FPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber FPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'FPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'FPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'FRL' using root@localhost branch 'FRL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber FRL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'FRL', categorycode = PT pass 2 No letter code found for pass 2 branch 'FRL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'IPT' using root@localhost branch 'IPT', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber IPT | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'IPT', categorycode = PT pass 2 No letter code found for pass 2 branch 'IPT', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'LPL' using root@localhost branch 'LPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber LPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'LPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'LPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'MPL' using root@localhost branch 'MPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber MPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'MPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'MPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'PVL' using root@localhost branch 'PVL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber PVL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'PVL', categorycode = PT pass 2 No letter code found for pass 2 branch 'PVL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'RPL' using root@localhost branch 'RPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber RPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'RPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'RPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'SPL' using root@localhost branch 'SPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber SPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'SPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'SPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'TPL' using root@localhost branch 'TPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber TPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'TPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'TPL', categorycode = PT pass 3 No letter code found for pass 3 ====================================== branchcode : 'UPL' using root@localhost branch 'UPL', categorycode = PT pass 1 Using letter code 'ODUE' for pass 1 --------Borrower SQL------ SELECT issues.borrowernumber, firstname, surname, address, address2, city, zipcode, country, email, emailpro, B_email, smsalertnumber, phone, cardnumber, date_due FROM issues,borrowers,categories,items WHERE issues.borrowernumber=borrowers.borrowernumber AND borrowers.categorycode=categories.categorycode AND issues.itemnumber = items.itemnumber AND items.itemlost = 0 AND TO_DAYS(NOW())-TO_DAYS(issues.date_due) >= 0 AND issues.branchcode=? AND borrowers.categorycode=? AND categories.overduenoticerequired=1 ORDER BY issues.borrowernumber UPL | PT (1, 90, 2025-12-26T01:18:23) -------------------------- Found 0 borrowers with overdues branch 'UPL', categorycode = PT pass 2 No letter code found for pass 2 branch 'UPL', categorycode = PT pass 3 No letter code found for pass 3 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189965|0 |1 is obsolete| | --- Comment #6 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190949 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190949&action=edit Bug 41315: Change only notice branchcode when OverDueNoticeFrom is set to patron-homelibrary This patch adds a new variable $notice_branchcode and uses this when getting the patron's homelibrary to ensure we don't change the branch we are using. To test: 1 - At branch A - checkout three items, 1 day overdue to 3 patrons of the same category from different branches (not A) 2 - Set the system preference OverdueNoticeFrom to 'patron home library' 3 - Browse to More->Tools->Overdue notice/status triggers 4 - Set overdue triggers for default library and the category used above to: Delay: 1 Letter: Overdue notice (ODUE) 5 - From the command line run the overdue notices: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 6 - Note that we begin pass 1 with CPL and then use a different branch for passes 2 and 3 7 - Apply patch 8 - Repeat 9 - Confirm branch is consistent 10 - Run without branch param: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 11 - Confirm branches are consistent Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189966|0 |1 is obsolete| | --- Comment #7 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190950 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190950&action=edit Bug 41315: Remove unecessary conditional We are in a loop here: foreach my $branchcode (@branches) { branchcode must be defined or something has gone seriously wrong with PERL Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189967|0 |1 is obsolete| | --- Comment #8 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190951 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190951&action=edit Bug 41315: (follow-up) Rename statements for clarity Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #189968|0 |1 is obsolete| | --- Comment #9 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- Created attachment 190952 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=190952&action=edit Bug 41315: Don't change which branch is used for getting the transports See bug 41316 - the script uses the triggers of the issuing branch when sending by patron library - we shouldn't change this here, but on the next bug Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190949|0 |1 is obsolete| | --- Comment #10 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 191911 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191911&action=edit Bug 41315: Change only notice branchcode when OverDueNoticeFrom is set to patron-homelibrary This patch adds a new variable $notice_branchcode and uses this when getting the patron's homelibrary to ensure we don't change the branch we are using. To test: 1 - At branch A - checkout three items, 1 day overdue to 3 patrons of the same category from different branches (not A) 2 - Set the system preference OverdueNoticeFrom to 'patron home library' 3 - Browse to More->Tools->Overdue notice/status triggers 4 - Set overdue triggers for default library and the category used above to: Delay: 1 Letter: Overdue notice (ODUE) 5 - From the command line run the overdue notices: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 6 - Note that we begin pass 1 with CPL and then use a different branch for passes 2 and 3 7 - Apply patch 8 - Repeat 9 - Confirm branch is consistent 10 - Run without branch param: perl misc/cronjobs/overdue_notices.pl --triggered --library CPL --test --nomail -v -v 11 - Confirm branches are consistent Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> 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=41315 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190950|0 |1 is obsolete| | --- Comment #11 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 191912 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191912&action=edit Bug 41315: Remove unecessary conditional We are in a loop here: foreach my $branchcode (@branches) { branchcode must be defined or something has gone seriously wrong with PERL Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> 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=41315 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190951|0 |1 is obsolete| | --- Comment #12 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 191913 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191913&action=edit Bug 41315: (follow-up) Rename statements for clarity Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> 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=41315 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #190952|0 |1 is obsolete| | --- Comment #13 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Created attachment 191914 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191914&action=edit Bug 41315: Don't change which branch is used for getting the transports See bug 41316 - the script uses the triggers of the issuing branch when sending by patron library - we shouldn't change this here, but on the next bug Signed-off-by: Ben Daeuber <bdaeuber@fargolibrary.org> 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=41315 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 --- Comment #14 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- Passing QA. Having the impression that the changes around patron-homebranch did not make this code easier to maintain etc.. Just a minor observation. This looks dubious (L516): if ($owning_library) { $item_sql .= ' AND items.homebranch = ? ' unless ($patron_homelibrary); If you set item-homebranch, why test if it is patron-homebranch ? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |release-notes-needed -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |26.05.00 released in| | Status|Passed QA |Pushed to main -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #15 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- Nice work everyone! Pushed to main for 26.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 Jacob O'Mara <jacob.omara@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|26.05.00 |26.05.00,25.11.03 released in| | Status|Pushed to main |Pushed to stable -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41315 --- Comment #16 from Jacob O'Mara <jacob.omara@openfifth.co.uk> --- Thanks all, pushed to 25.11.x -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org