From c21bfa203d638e293d4365855be0bb91ef548f88 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Tue, 1 Apr 2025 14:16:04 +0000 Subject: [PATCH] Bug 38925: Update record 'date entered on file' when duplicating a record -- in advanced editor (MARC21) With Bug 36552 we set 'date entered on file' (MARC21: 008/0-5) of a record created by duplication of an existing record to the current date instead of having there the value from the original record. The same should be done for the advanced editor (for now, it retains the date of the original record). Test plan: ========== 1. Enable EnableAdvancedCatalogingEditor systempreference. 2. Open any record in advanced editor to make it default. Go back to record normal display. 3. Make a duplicate: Edit > Edit as new (duplicate) 4. Note that the date in 008/0-5 is of the original record, not of today. 5. Apply the patch ; restart_all. 6. Repeat p. 3. The date in 008/0-5 should be of the today. If not, refresh browser's cache (Ctrl+Shift+R etc.) to get the fresh version of the JS. --- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 4 ++++ 1 file changed, 4 insertions(+) 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 f51950f3b8..494d466bc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -423,6 +423,10 @@ if ( !record.error ) { var remove_control_num = [% IF Koha.Preference('autoControlNumber') == 'OFF' %] false [% ELSE %] true [% END %]; 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)); + } editor.displayRecord( record ); editor.focus(); } -- 2.39.5