From dfe821f504d6023ee80c15cc7603b82bd067357a Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Wed, 10 Sep 2025 18:37:08 +0300 Subject: [PATCH] Bug 40584: show 001 in Advanced Editor and preserve its existing value instead of overwriting it This patch makes the 001 field visible when editing a record in the advanced editor and fixes a bug where, if the syspref autoControlNumber was set to "generated as biblionumber," editing a record through the advanced editor would overwrite the existing 001 value. 1. Create a new record with a custom "001 Control Number" MARC field, don't use biblionumber as control number. 2. In the system preferences set EnableAdvancedCatalogingEditor to "enable" and autoControlNumber to "generated as biblionumber" 3. Edit record, switch to advanced editor either through option in the "Settings" dropdown menu or switch on top right of the page. 4. In the advanced editor see that it doesn't show 001 field, no need to change anything just use the save button to save the record. 5. On the record page see MARC preview, it's gonna be overwritten by the value of biblionumber. 6. With basic editor change the 001 field to your old custom value. 7. Apply the patch. 8. Use the advanced editor again, 001 field should be visible now. 9. Use the save button to save the record. Make sure that your custom value is still there by using MARC preview on records page. --- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index 3ba6d17293f..f146228bf7c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -410,8 +410,8 @@ backends[ parts[0] ].get( parts[1], function( record ) { if ( !record.error ) { - var remove_control_num = [% IF Koha.Preference('autoControlNumber') == 'OFF' %] false [% ELSE %] true [% END %]; - if( remove_control_num ){ record.removeField("001"); } + var remove_control_num = ([% IF Koha.Preference('autoControlNumber') == 'OFF' %] false [% ELSE %] true [% END %]) && (parts[0] === 'duplicate'); + if remove_control_num { record.removeField("001"); } if( parts[0] === 'duplicate' ) { let today = new Date(); record.field('008').subfield('@', today.toISOString().substring(2,10).replaceAll('-','') + record.field('008').subfield('@').substring(6)); -- 2.50.1