From 37a1dd112f29b3dde4a64b674fd097930d82267a 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. Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize --- 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 f82330c7a5c..3ba6d17293f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -412,6 +412,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.49.0