From f089c81ed6f13908f511b8d2b0cc1f6cc1e7bf63 Mon Sep 17 00:00:00 2001 From: Oleg Vasylenko Date: Wed, 25 Jan 2017 12:01:05 +0200 Subject: [PATCH 3/3] Bug 17988 - Select2 prevents correct tag expand/minimize functionality MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Overview: Select2 (Bug 13501) introduced divs and inputs that broke some assumptions about the expected HTML structure. Because of that, expanding fields to show all hidden subfields does not work properly. Steps to Reproduce: 1. Open some book in the editor or create new (cataloguing/addbiblio.pl) 2. Try to minimize or expand fields, that have among subfields the following: — Thesaurus driven subfield → subfield with Select2 — Hidden subfield. Actual Results:  — some fields become hidden, some not, and vice versa  — in the console, you'll see «Uncaught TypeError: Cannot read property 'match' of null» Expected Results:  — all subfields should minimize/maximize completely Additional Information: This happens because Select2 adds some divs, that do not have ID property. The following patch adds check for the needed attribute existance. --- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 1 + 1 file changed, 1 insertion(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index 59efd6ce56..f4abf2fa37 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -59,6 +59,7 @@ function ExpandField(index) { var original = document.getElementById(index); //original
var divs = original.getElementsByTagName('div'); for(var i=0,divslen = divs.length ; i show all subfields -- 2.11.0.windows.1