| Summary: | Fallback on bookable itemtype can break if item has no itemtype | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Paul Derscheid <paul.derscheid> |
| Component: | Circulation | Assignee: | Bugs List <koha-bugs> |
| Status: | Signed Off --- | QA Contact: | Testopia <testopia> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | gmcharlt, kyle |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: | ||
| Circulation function: | |||
| Attachments: |
Bug 41510: Add test for effective_bookable with missing itemtype
Bug 41510: Handle undefined itemtype in item->effective_bookable Bug 41510: Add test for effective_bookable with missing itemtype Bug 41510: Handle undefined itemtype in item->effective_bookable |
||
|
Description
Paul Derscheid
2026-01-02 09:21:36 UTC
Created attachment 190820 [details] [review] Bug 41510: Add test for effective_bookable with missing itemtype - Add test case for the scenario where an item has no itemtype because both items.itype and biblioitems.itemtype are NULL - Note: We must set biblioitems.itemtype to NULL before creating the item because Koha::Item->store() automatically populates itype from biblioitems.itemtype when itype is not set Test plan: - Apply this patch only - Run: prove t/db_dependent/Koha/Item.t :: effective_bookable - Verify test 6 FAILS with "Can't call method 'bookable' on an undefined value" - Apply the follow-up patch - Run the test again - Verify all tests PASS Created attachment 190821 [details] [review] Bug 41510: Handle undefined itemtype in item->effective_bookable - Guard against undefined itemtype before calling ->bookable on it - Return 0 (not bookable) when no itemtype is found and item-level bookable is not defined Created attachment 190854 [details] [review] Bug 41510: Add test for effective_bookable with missing itemtype - Add test case for the scenario where an item has no itemtype because both items.itype and biblioitems.itemtype are NULL - Note: We must set biblioitems.itemtype to NULL before creating the item because Koha::Item->store() automatically populates itype from biblioitems.itemtype when itype is not set Test plan: - Apply this patch only - Run: prove t/db_dependent/Koha/Item.t :: effective_bookable - Verify test 6 FAILS with "Can't call method 'bookable' on an undefined value" - Apply the follow-up patch - Run the test again - Verify all tests PASS Signed-off-by: David Nind <david@davidnind.com> Created attachment 190855 [details] [review] Bug 41510: Handle undefined itemtype in item->effective_bookable - Guard against undefined itemtype before calling ->bookable on it - Return 0 (not bookable) when no itemtype is found and item-level bookable is not defined Signed-off-by: David Nind <david@davidnind.com> |