https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41672
Tomás Cohen Arazi (tcohen) <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #1 from Tomás Cohen Arazi (tcohen) <[email protected]> --- (In reply to Johanna Räisä from comment #0) > The current code uses find() to look up records with a field other than the > primary key. However, find() is intended only for primary key lookups and > may not work as expected with other fields. > To ensure correct and future-proof behavior, replace find() with > search()->next when searching by non-primary key fields. > > For example, use: > Koha::Checkouts->search({ itemnumber => $item->itemnumber })->next; > instead of: > Koha::Checkouts->find({ itemnumber => $item->itemnumber }); > This change improves code reliability and compatibility with possible future > schema changes. You are right. I made the SIP code report more reliably about empty keys, but only dealt with patron searching: ``` ILS/Patron.pm: $patron = Koha::Patrons->find_by_identifier($patron_id); ``` I believe we should implement such methods for items/checkouts to complete the work i.e. Koha::Patrons->find_by_identifier does exactly what you are suggesting. -- 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/
