Bug 31538 - Crash on item tab of a record with UNIMARC
Summary: Crash on item tab of a record with UNIMARC
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: Main
Hardware: All All
: P5 - low blocker
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-08 16:38 UTC by Victor Grousset/tuxayo
Modified: 2024-04-12 11:48 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Grousset/tuxayo 2022-09-08 16:38:59 UTC
== test plan ==
1. start a UNIMARC Koha with sample data
2. search for any record
3. go to item tab
4. error Can't call method "notforloan" on an undefined value at /kohadevbox/koha/catalogue/moredetail.pl line 189
Comment 1 Joonas Kylmälä 2022-09-08 17:23:30 UTC Comment hidden (obsolete)
Comment 2 Joonas Kylmälä 2022-09-08 19:08:49 UTC
We are not checking whether the item in question has an itemtype. Need to add a check for that. Patch coming right up.
Comment 3 Joonas Kylmälä 2022-09-08 19:33:25 UTC
Actually, do we require itemtypes? If not, then at least the regression is caused by 

Bug 24185: Make holds page faster: Preparatory refactoring

>+ Koha::ItemTypes->find( $i->effective_itemtype() )->notforloan

and bug 27272 related dependencies.
Comment 4 Joonas Kylmälä 2022-09-08 19:48:29 UTC
So after grepping for Koha::ItemTypes->find I can see almost all places in Koha expect there to be an itemtype to be defined. Koha just doesn't want to work without itemtypes, and for some reason the unimarc default data seems to come without itemtypes linked to the items. Putting back to NEW status. Need to discuss first how to proceed.
Comment 5 Joonas Kylmälä 2022-09-08 19:49:39 UTC
Unfortunately we don't seem to have foreign key constraint from items table to itemtypes table, so these errors are bound to happen.
Comment 6 Victor Grousset/tuxayo 2022-09-16 00:23:39 UTC
Thanks for the analysis :)

> unimarc default data

Is that just about sample data that is inserted directly via SQL? Or is that something that valid UI usage can produce?
Comment 7 Jonathan Druart 2022-11-11 12:13:08 UTC
This looks like a data problem from misc4dev. You should report the problem there (which I won't fix myself however).
Comment 8 Victor Grousset/tuxayo 2024-04-12 11:48:03 UTC
For anyone coming here, the problem has been reported in this ticket

gitlab DOT com/koha-community/koha-misc4dev/-/issues/76