From ab8780915c1989edd5e1d809fb3d151368cdddb3 Mon Sep 17 00:00:00 2001
From: Mark Tompsett <mtompset@hotmail.com>
Date: Mon, 5 Jun 2017 12:24:07 -0400
Subject: [PATCH] Bug 18730: Batch Mod Edit <label> HTML validation fails
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

[tag] [reply] [−] Description M. Tompsett 2017-06-05 16:30:21 UTC
Know the barcode of an existing item.
Home -> Tools -> Batch Item Modification
Enter the barcode
Click
View Page source
select and copy it into validator.w3.org direct input.
There will be complaints about <labels>.

Apply this patch

refresh the page.
select and copy it into validator.w3.org direct input.
There will be no complaints about <labels>.

This is intended to be a highly focused HTML bug, as the
missing form tag which will fix the <div> issues at the bottom
is corrected on bug 18710.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
---
 koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
index c04733c7ea..e979494903 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt
@@ -193,15 +193,15 @@ $(document).ready(function(){
         [% FOREACH ite IN item %]
           <li>
             <div class="subfield_line" style="[% ite.visibility %]" id="subfield[% ite.tag %][% ite.subfield %][% ite.random %]">
+              [% SET mv = ite.marc_value %]
               [% IF ( ite.mandatory ) %]
-                <label class="required" for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
+                <label class="required" for="[%- mv.id -%]">
               [% ELSE %]
-                <label for="tag_[% ite.tag %]_subfield_[% ite.subfield %]_[% ite.random %]">
+                <label for="[%- mv.id -%]">
               [% END %]
                 [% ite.subfield %] - [% ite.marc_lib %]
               </label>
 
-              [% SET mv = ite.marc_value %]
               [% IF ( mv.type == 'select' ) -%]
                 <select name="[%- mv.name -%]" id="[%- mv.id -%]" size="1" tabindex="1" class="input_marceditor">
                   [%- FOREACH aval IN mv.values %]
-- 
2.11.0