From de5917821a55ec5bcb347811a31a61104f010cd5 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Tue, 24 Mar 2026 16:50:43 +0000 Subject: [PATCH] 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 Signed-off-by: Lucas Gass --- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 628fb80163..c578f6249d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -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();