Bug 40711

Summary: Fix value builder for 181 in UNIMARC
Product: Koha Reporter: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Component: CatalogingAssignee: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david, m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Fixes the value builder for UNIMARC 181$c and 181$2: - 181$c: now inserts the correct codes from the dropdown list (previously, it would populate the field with incorrect values - choosing cri would not add a value, crm would insert an a as the value) - 181$2: now uses the correct HTML body ID (previously it was cat_unimarc_field_182-2, now it is cat_unimarc_field_181-2)
Version(s) released in:
Circulation function:
Attachments: Bug 40711: Fix valuebuilder for UNIMARC 181c
Bug 40711: Fix valuebuilder for UNIMARC 181c and 2
Bug 40711: Fix valuebuilder for UNIMARC 181c and 2

Description Baptiste Wojtkowski (bwoj) 2025-08-27 09:58:28 UTC
There are some little issues with valuebuilder that need a fix
Comment 1 Baptiste Wojtkowski (bwoj) 2025-08-27 12:02:57 UTC
Created attachment 185812 [details] [review]
Bug 40711: Fix valuebuilder for UNIMARC 181c

Test plan (UNIMARC ONLY):
1 - Make sure you have valuebuilder enabled for 181$c and 181$2 (see hereafter)
2 - Edit any record. Use valuebuilder to set 181$c to "cri - cartographic image", notice there is no change
3 - Use valuebuilder to set 181$c to "crm - cartographic moving image", notice it is set to "a"
4 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_182-2.
5 - Apply patch
6 - Repeat 2&3 and notice the codes are now cri respectively cri and crm
7 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_181-2.
Comment 2 Baptiste Wojtkowski (bwoj) 2025-08-27 12:05:55 UTC
Created attachment 185813 [details] [review]
Bug 40711: Fix valuebuilder for UNIMARC 181c and 2

Test plan (UNIMARC ONLY):
1 - Make sure you have valuebuilder enabled for 181$c and 181$2 (see hereafter)
2 - Edit any record. Use valuebuilder to set 181$c to "cri - cartographic image", notice there is no change
3 - Use valuebuilder to set 181$c to "crm - cartographic moving image", notice it is set to "a"
4 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_182-2.
5 - Apply patch
6 - Repeat 2&3 and notice the codes are now cri respectively cri and crm
7 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_181-2.
Comment 3 David Nind 2025-12-27 01:33:25 UTC
Created attachment 190744 [details] [review]
Bug 40711: Fix valuebuilder for UNIMARC 181c and 2

Test plan (UNIMARC ONLY):
1 - Make sure you have valuebuilder enabled for 181$c and 181$2 (see hereafter)
2 - Edit any record. Use valuebuilder to set 181$c to "cri - cartographic image", notice there is no change
3 - Use valuebuilder to set 181$c to "crm - cartographic moving image", notice it is set to "a"
4 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_182-2.
5 - Apply patch
6 - Repeat 2&3 and notice the codes are now cri respectively cri and crm
7 - Open the valuebuilder for 181$2 and inspect the body ID. See it is cat_unimarc_field_181-2.

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-12-27 01:53:13 UTC
Testing notes (using KTD):

0. Start up a UNIMARC instance: KOHA_MARC_FLAVOR=unimarc ktd up

1. To make sure the value builder is triggered when editing a record:
   1.1 Go to Koha administration > Catalog > MARC bibliographic frameworks > Default framework > Actions > MARC structure
   1.2 Search for tag 181
   1.3 Actions > Edit subfields
   1.4 For 181$2, add unimarc_field_181-2.pl as the plugin
   1.5 For 181$c:
       - remove unimarc_181c from authorized value
       - add unimarc_field_181c.pl as the plugin

2. I added the assignee, changed the importance from 'enhancement' to 'normal', as it fixes something not working correctly.

3. Added a draft release note.