Bug 28846 - MarcRecordFromNewSuggestion needs mapping to biblioitems.itemtype
Summary: MarcRecordFromNewSuggestion needs mapping to biblioitems.itemtype
Status: Needs Signoff
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Baptiste Wojtkowski (bwoj)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-12 01:18 UTC by Fridolin Somers
Modified: 2025-10-27 11:33 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 28846: Check if biblioitems.itemtype mapping exists before using itemtypes in suggestions (4.18 KB, patch)
2025-10-27 11:33 UTC, Baptiste Wojtkowski (bwoj)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2021-08-12 01:18:57 UTC
In C4::Suggestions, MarcRecordFromNewSuggestion uses mapping to biblioitems.itemtype :
https://git.koha-community.org/Koha-community/Koha/src/commit/e9428f662fe2ec0271878ec78886e7f95a25a9e1/C4/Suggestions.pm#L614

But this Koha to MARC mapping may not exists when itemtype is on item level.
Same for biblio.autor, even if unlikely.
Comment 1 Katrin Fischer 2022-07-16 11:58:55 UTC
Libraries using item-level itypes usually still have the mapping on record level, although they might set it to be not mandatory in cataloguing. There is a lot of functionality tied to the record level itype, even when using item level itypes, so both make sense to have.

biblio.author should also exist.

Is this to avoid an explosion if the mapping doesn't exist?

I tried to remove both and create a record from a suggestion:

* Administration > Kohat-to-MARC-Mapping, unmap biblio.author and biblioitems.itemtype (not a good idea, but for testing)
* Add a new suggestion > BOOM!

Tag "" is not a valid tag. at /kohadevbox/koha/C4/Suggestions.pm line 492.

This is actually odd, because creating a suggestions doens't create a MARC record yet.

Is this a non-fix if mappings are also required in other places or an even bigger issue?
Comment 2 Baptiste Wojtkowski (bwoj) 2025-10-22 14:05:11 UTC
We have a big customer that has no mapping there for a long time and only experienced a problem recently while trying to use the suggestion module. I'll propose a patch to fix issue there ; I don't think other parts of Koha are broken without this mapping, and if it is the case, they should probably be fixed each time.
Comment 3 Baptiste Wojtkowski (bwoj) 2025-10-27 11:33:35 UTC
Created attachment 188472 [details] [review]
Bug 28846: Check if biblioitems.itemtype mapping exists before using itemtypes in suggestions

Test plan:
1 - Ensure you have no mappings on biblioitems.itemtype
2 - Create a suggestion -> there is a field "Document type" you get an error when submitting.
3 - Apply patch
4 - Create a suggestion -> there is no field anymore and you get no error
5 - Put back the mapping on biblioitems.itemtype and check the field "Document type" is still present suggestion form