Bug 19484 - Checkout page does not like itemtype NULL
Summary: Checkout page does not like itemtype NULL
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact: Kyle M Hall
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-10-18 13:59 UTC by Marcel de Rooy
Modified: 2018-06-04 20:18 UTC (History)
4 users (show)

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


Attachments
Bug 19484: Add test before using object itemtype (1.45 KB, patch)
2017-10-18 14:04 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 19484: Add test before using object itemtype (1.23 KB, patch)
2017-10-19 00:13 UTC, Dilan Johnpullé
Details | Diff | Splinter Review
Bug 19484: Add test before using object itemtype (1.28 KB, patch)
2017-10-27 13:30 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2017-10-18 13:59:55 UTC
Somehow an imported item had no itemtype (might be another bug btw), but anyway it results in a never ending loading of checkouts since svc/checkouts crashes.
Resolved by a simple test.

item-level_itypes set but no itemtype set for item (451) at /usr/share/koha/masterclone/Koha/Schema/Result/Item.pm line 698.
Can't call method "translated_description" on an undefined value at /usr/share/koha/masterclone/svc/checkouts line 168.
Comment 1 Marcel de Rooy 2017-10-18 14:04:43 UTC
Created attachment 68250 [details] [review]
Bug 19484: Add test before using object itemtype

Resolves this crash:
item-level_itypes set but no itemtype set for item (451) at /usr/share/koha/masterclone/Koha/Schema/Result/Item.pm line 698.
Can't call method "translated_description" on an undefined value at /usr/share/koha/masterclone/svc/checkouts line 168.

Test plan:
[1] Create/update an item so that it has itemtype NULL.
[2] Check it out on Circulation page.
    Before this patch the loading would never stop.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2017-10-18 14:49:54 UTC
Since itype is not a foreign key, it would also work to put say BKS into itype when you only have BK in your item types. (Update via mysql.)
Comment 3 Marcel de Rooy 2017-10-18 15:00:13 UTC
Since importing unknown itemtypes is possible, I am wondering what the severity of this bug should be btw..
Comment 4 Dilan Johnpullé 2017-10-19 00:13:19 UTC
Created attachment 68285 [details] [review]
Bug 19484: Add test before using object itemtype

Patch applies and functions as described. I agree with you that importing NULL itemtypes is possible Marcel. A higher importance level makes sense.

Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>
Comment 5 Marcel de Rooy 2017-10-19 06:24:09 UTC
(In reply to Dilan Johnpullé from comment #4)
> Created attachment 68285 [details] [review] [review]
> Bug 19484: Add test before using object itemtype
> 
> Patch applies and functions as described. I agree with you that importing
> NULL itemtypes is possible Marcel. A higher importance level makes sense.
> 
> Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Thanks
Comment 6 Kyle M Hall 2017-10-27 13:30:40 UTC
Created attachment 68703 [details] [review]
Bug 19484: Add test before using object itemtype

Patch applies and functions as described. I agree with you that importing NULL itemtypes is possible Marcel. A higher importance level makes sense.

Signed-off-by: Dilan Johnpullé <dilan@calyx.net.au>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 7 Jonathan Druart 2017-10-27 15:28:40 UTC
There was a thread on the ML: http://lists.koha-community.org/pipermail/koha-devel/2017-July/043841.html
"Expected behaviour if itemtype does not exist"

The correct solution would be to provide a script to make sure the data are correct and/or display a warning message on the about page.
Comment 8 Jonathan Druart 2017-10-27 17:17:10 UTC
Pushed to master for 17.11, thanks to everybody involved!