Bug 34266: Default to biblioitems.itemtype only if it's a valid itemtype
authorJulian Maurice <julian.maurice@biblibre.com>
Thu, 13 Jul 2023 07:22:44 +0000 (09:22 +0200)
committerMatt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Fri, 15 Sep 2023 09:33:04 +0000 (09:33 +0000)
commitc3fce7850a12a69db42b43141fe57244bcaaa654
tree363692dcf5afb1e0b338e97d1470b4b212313a23
parent31e0e7a02416c6e04fff76da63d1dc15669ff4f1
Bug 34266: Default to biblioitems.itemtype only if it's a valid itemtype

biblioitems.itemtype can contain values that are not itemtypes (for
instance if the MARC field mapped to it uses another authorised value
category)
This patch checks that before using it as a default value for the
'itemtypes' item subfield.

Test plan:
0. Do not apply the patch yet
1. Change your MARC framework so that the field linked to
   biblioitems.itemtype uses an authorised value category different from
   'itemtypes'
2. Make sure that you have an item subfield linked to the authorised
   value 'itemtypes' in your MARC framework
3. Create a biblio with an itemtype (using a value that is NOT an item
   type, but a value from the authorised value category you selected in
   step 1)
4. Create a new item for this biblio. Notice that the biblio itemtype is
   automatically selected for the 'itemtypes' subfield
5. Apply the patch
6. Create a new item for the same biblio. Now the 'itemtypes' subfield
   should be empty.
7. Revert the change at step 1 so that your biblioitems.itemtype MARC
   field uses the 'itemtypes' AV category
8. Modify your biblio to use a valid item type.
9. Create a new item. The biblio itemtype should be used as a default
   value

Signed-off-by: joubu <xxx@example.org>
Signed-off-by: tuxayo <victor@tuxayo.net>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 807c58d28d7be4fa1a9606cd6cf2f59f661249ec)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 27fa85423e87be084b22a974f80984493641272d)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Koha/UI/Form/Builder/Item.pm