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
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Laura_Escamilla <laura.escamilla@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit c28b9b86ca)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
This commit is contained in:
Emmi Takkinen 2026-02-12 09:37:15 +02:00 committed by Baptiste Wojtkowski
parent 1203c94195
commit c18d62e71d
No known key found for this signature in database
GPG Key ID: 47A8A13E10BC0D40
1 changed files with 8 additions and 1 deletions

View File

@ -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) {