Bug 42166: Check for 008 before adding the date to it

To test:
1. Edit or create a framework that does not require the 008.
2. Make or edit a record in that framework without a 008.
3. Turn on EnableAdvancedCatalogingEditor, and make sure you are using the advanced editor.
4. Go to the record from step 2 and click "Edit as new (duplicate)"
5. The record won't load in the advanced editor.
6. APPLY PATCH
7. Try again, this time the record should load when using "Edit as new (duplicate)".

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
Lucas Gass 2026-03-24 16:50:43 +00:00 committed by Pedro Amorim
parent 96de51c53d
commit 35bbb013ba
No known key found for this signature in database
GPG Key ID: 06B75BA7F3894D55
1 changed files with 4 additions and 1 deletions

View File

@ -414,7 +414,10 @@
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));
let field008 = record.field('008');
if ( field008 ) {
record.field('008').subfield('@', today.toISOString().substring(2,10).replaceAll('-','') + record.field('008').subfield('@').substring(6));
}
}
editor.displayRecord( record );
editor.focus();