Bug 17988 - Select2 prevents correct tag expand/minimize functionality
authorOleg Vasylenko <synapse.ova@gmail.com>
Wed, 25 Jan 2017 10:01:05 +0000 (12:01 +0200)
committerMason James <mtj@kohaaloha.com>
Wed, 22 Feb 2017 20:36:23 +0000 (09:36 +1300)
commitae7de6f6844118f75ca0ac39bbdb1df488a90f3a
tree7425cc90e52cd6fc9c1e762c9b28a71b28ab28ca
parent1c3c5301818444d8f0210bb5864cd4974cb5bcac
Bug 17988 - Select2 prevents correct tag expand/minimize functionality

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.

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Mason James <mtj@kohaaloha.com>
koha-tmpl/intranet-tmpl/prog/js/cataloging.js