https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42935 Bug ID: 42935 Summary: Koha::Item->_status croaks when an item references a non-existent item type Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: paul.derscheid@lmscloud.de QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Koha::Item->_status calls $self->item_type->notforloan. item_type resolves via Koha::ItemTypes->find( $self->effective_itemtype ), which returns undef when the item's effective item type is set to a value that has no matching row in the itemtypes table. _status then croaks with: Can't call method "notforloan" on an undefined value at Koha/Item.pm This is the non-NULL-but-invalid case (an orphaned itype value, not an empty one). Impact: a 500 on GET /api/v1/biblios/{biblio_id}/items (the _status embed), so the catalogue detail items table fails to load for the whole record if any one of its items references a non-existent item type. The state is not reachable through normal editing; it arises out of band, e.g. deleting an item type still referenced by items, or an SQL import/migration - which Koha already flags as a data inconsistency (Koha::Database::DataInconsistency::invalid_item_type). To reproduce (item-level itypes): 1. UPDATE items SET itype = 'NOPE' WHERE itemnumber = <X>; ('NOPE' being any value absent from the itemtypes table) 2. Open that record's detail page in the staff interface. => the items table fails to load; the plack log shows the croak above. Expected: the item row loads; a non-existent item type must not be treated as a croak (and should not count as not-for-loan). -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.