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: [email protected]
Reporter: [email protected]
QA Contact: [email protected]
CC: [email protected]
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.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/