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 <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Janusz Kaczmarek 2025-04-01 14:16:04 +00:00 committed by Katrin Fischer
parent b37d107aa3
commit c0b3310ab8
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 4 additions and 0 deletions

View File

@ -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();
}