Bug 17780 - When choose an author in authority results new window shows a blank screen

Select2 (Bug 13501) introduced divs and inputs that broke some assumptions about the expected HTML structure.
This patch checks if input has name attribute, because some inputs in Select2 have not.

To test:
Try to add info from the authorities to field that has subfield with Select2 (subfield with authorised values on Koha 16.11+)

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

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
(cherry picked from commit 444bdcc2a5)
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
This commit is contained in:
Oleg Vasylenko 2017-01-24 17:58:39 +02:00 committed by Katrin Fischer
parent 2cd3236330
commit e2b22a3195
1 changed files with 1 additions and 0 deletions

View File

@ -90,6 +90,7 @@
var subfields = field_start.getElementsByTagName('input');
var re = /^tag_\d*_code_/;
for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields
if(subfields[i].hasAttribute('name') == 0 ) {continue; }
if(subfields[i].getAttribute('name').match(re)){ // it s a subfield
var code = subfields[i]; // code is the first input
var subfield = subfields[i+1]; // subfield the second