From 6afe89505ab28da0eb5305df466bb97837fa7495 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 14 Dec 2021 12:08:13 +0100 Subject: [PATCH] Bug 29689: (bug 28445 follow-up) Fix AutoBarcode=hbyymmincr The selector is not correct, we need to use .input_marceditor instead of name="field_value". Test plan: Set autoBarcode=yymm0001 Catalogue a new item, click into the barcode input Notice that without this patch you get a JS error in the console Uncaught TypeError: form.field_value is undefined Focustag_952_subfield_p_878344 Focustag_952_subfield_p_878344_handler jQuery 11 BindEventstag_952_subfield_p_878344 With this patch applied the barcode is correctly generated. QA Note: it would be way easier if all add item forms were using the new methods, it could be: let loc = document.getElementsByName('items.homebranch')[0].value; Yes, that's all! --- C4/Barcodes/ValueBuilder.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/C4/Barcodes/ValueBuilder.pm b/C4/Barcodes/ValueBuilder.pm index ea8bffafa37..1bef9cdbfaf 100644 --- a/C4/Barcodes/ValueBuilder.pm +++ b/C4/Barcodes/ValueBuilder.pm @@ -64,13 +64,13 @@ sub get_barcode { if ( !form ) { form = document.getElementById('Aform'); } - for (i=0 ; i{loctag}' && form.subfield[i].value == '$args->{locsubfield}') { fnum = i; } } if (\$('#' + id).val() == '') { - \$('#' + id).val(form.field_value[fnum].value + '$nextnum'); + \$('#' + id).val(form.getElementsByClassName('input_marceditor')[fnum].value + '$nextnum'); } "; return $nextnum, $scr; -- 2.25.1