From e82405f15fa847a6255154baa6b5211b23ce4e57 Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Thu, 17 Aug 2023 11:37:30 +0000
Subject: [PATCH] Bug 34565: Label mismatch in MARC21 006 and 008 cataloging
 plugins

This patch modifies the JS which builds the table of options for
populating MARC21 fields 006 and 008 when using the cataloging plugin.

To test, apply the patch and go to Cataloging -> New record.

- Click the plugin trigger link next to the 006 input field (you may
  need to click the tag to expand it.
- In the table of input fields, test that clicking the label, e.g. "Type
  of material", "00 - Form of material," etc,  moves focus to the
  corresponding form field.
- Perform the same test on the plugin-popup for field 008.
---
 koha-tmpl/intranet-tmpl/prog/js/xmlControlfield.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/xmlControlfield.js b/koha-tmpl/intranet-tmpl/prog/js/xmlControlfield.js
index 25acae56fa4..052cb9f39fd 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/xmlControlfield.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/xmlControlfield.js
@@ -307,7 +307,7 @@ function changeH4Result(form, h4_result, tr_result, pos, value)
                             try {
                                 url = ((nodePos.getAttributeNode("url") || nodePos.hasAttribute("url")) && nodePos.getAttribute("url") != "" && nodePos.getElementsByTagName('urltext')[0].textContent != "")?"&nbsp;<a href='" + nodePos.attributes.getNamedItem("url").nodeValue + "' target='_blank'>" + nodePos.getElementsByTagName('urltext')[0].textContent + "</a>":"";
                             } catch (e) { url = "";}
-                            td.innerHTML = "<label for='" + pos + "' title='" + title + "'>" + pos + " - " + name + url + "</label>";
+                            td.innerHTML = "<label for='f" + pos + "' title='" + title + "'>" + pos + " - " + name + url + "</label>";
                             td = tr.insertCell(tr.cells.length);
                             value = returnValuePosFromResult(result, pos);
                             if ((index = pos.indexOf("-")) > 0) { // Position interval
-- 
2.30.2