From 6639771dec72fcea8ec4df7721f5a09c6d513168 Mon Sep 17 00:00:00 2001 From: Andrii Nugged Date: Mon, 9 Jun 2025 02:16:21 +0300 Subject: [PATCH] Bug 40092: Fill auto-populated control fields in MARC editors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Clicking Save doesn't fill control fields automatically in both the authority and bibliographic MARC editors. Regression introduced when class `framework_plugin` was added: `AreMandatoriesNotOk()` rewrites the element `class` attribute with a hard‑coded string, dropping existing classes. Because the plugins that populate 000/003/005/008 rely on `framework_plugin`, the inputs are skipped and the fields remain empty. This patch stops clobbering the attribute and instead appends the visual 'notFilled' class via `elt.classList.add()`. The one-line fix is applied in both `authorities.tt` and `addbiblio.tt`. Test plan: Authority editor 1. Authorities → New authority → choose framework (e.g. Topical term). 2. Leave all fields blank, click Save. Before patch: 000, 003, 008 remain blank; required tags turn yellow. 3. Apply patch, hard‑refresh, repeat steps 1–2. After patch: control fields auto‑populate as in 24.11. Bibliographic editor 1. Cataloguing → New record (Not in Advanced MARC editor). 2. Click Save without entering data. Before patch: control fields stay blank; record cannot be saved. 3. Apply patch, hard‑refresh, repeat. After patch: record is blocked, but 000/005/008 auto‑populate. Both editors behave like 24.11; mandatory highlighting still works. Signed-off-by: David Nind --- .../intranet-tmpl/prog/en/modules/authorities/authorities.tt | 3 ++- .../intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 09f997a2af..466480e75f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -242,7 +242,8 @@ if ( elt.nodeName == 'SELECT' ) { $(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass); } else { - elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass); + // elt.setAttribute('class','input_marceditor noEnterSubmit framework_plugin ' + notFilledClass); + elt.classList.add(notFilledClass); } $('#' + subfields[i]).focus(); tabflag[tag+subfield+tagnumber][1]=label[i]; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 003358530c..5433e5c618 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -576,7 +576,8 @@ if ( elt.nodeName == 'SELECT' ) { $(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass); } else { - elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass); + // elt.setAttribute('class','input_marceditor noEnterSubmit framework_plugin ' + notFilledClass); + elt.classList.add(notFilledClass); } $('#' + subfields[i]).focus(); tabflag[tag+subfield+tagnumber][1]=label[i]; -- 2.39.5