From b04173f3085cae7d11f073441563ca7f7681a4e2 Mon Sep 17 00:00:00 2001 From: Emmi Takkinen Date: Thu, 12 Feb 2026 09:37:15 +0200 Subject: [PATCH] Bug 41829: Set correct id to copied Tag editor button When one copies MARC field, Tag editor button on fields containing value builder plugin have same id as original MARC field. This patch sets correct id to these buttons. To reproduce: 1. Find MARC framework which has value builder plugin attached to one of its fields. 2. Navigate to Cataloging -> New record. 3. Navigate to MARC field with plugin attached to it. 4. Inspect fields Tag editor button with browsers developer tools. -> Check the id of Tag editor button. 5. Copy the field and check id of copied Tag editor button. -> Notice that it has the same id as in original field. 6. Apply this patch. 7. Referesh the page, navigate back to field and copy it. 8. Inspect Tag editors id. -> Id should now be same as in other copied fields. Sponsored-by: Koha-Suomi Oy --- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index f35750951a..42a8a0e1ec 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -330,7 +330,7 @@ function CloneField(index, hideMarc, advancedMARCEditor) { // do nothing if label does not exist. } - // setting its '+' and '-' buttons + // setting its '+', '-' and 'buttonDot' buttons try { var anchors = divs[i].getElementsByTagName("a"); for (var j = 0; j < anchors.length; j++) { @@ -352,6 +352,13 @@ function CloneField(index, hideMarc, advancedMARCEditor) { divs[i].getAttribute("id") + "'); return false;" ); + } else if ( + anchors[j].getAttribute("id").match(/^buttonDot/) + ) { + anchors[j].setAttribute( + "id", + anchors[j].getAttribute("id") + new_key + ); } } } catch (e) { -- 2.34.1