Bug 9894 - (3.12) de-serialize the 'hidden' value for subfields in frameworks
This patch aims to provide a non-intrusive way (with respect to Koha's code, so
it could have got into 3.12) for the users to easily choose the visibility settings
for each subfield.
This patch is also known to have arrived late for 3.12. I've been struggling with
other stuff at work, but I just wanted to put this somewhere just in case it can
be reused or something else.
The patch adds two JavaScript functions that deal with (de)serialization of the 'hidden'
value for subfields. One each way. Listeners are added to the checkboxes so the (actually, heh)
'hidden' value gets correctly updated on each checkbox change.
There's a costly function to update all checkboxes on every tab to match the 'hidden' value on page load.
To test:
- open the docs to have at hand the list of codes/visibility options combinations and
try changing several subfields from a single tagfield. Save, and reopen the "Edit subfields" page.
- I had a MySQL shell opened to repeatedly run this query (i tested against field 886
on the default framework):
> SELECT tagfield,tagsubfield,hidden FROM marc_subfield_structure WHERE frameworkcode='' AND tagfield=886;
- Compare what was saved on the DB with the docs for that visibility selection.
Regards
To+
PS: I promise I'll work on the proper patch for 3.14, which would involve DB structure changes and
(more than I expected) rewriten code.
Sponsored-by: Universidad Nacional de Córdoba
Signed-off-by: Liz Rea <liz@catalyst.net.nz>
I promise to hug you the next time we meet. This works, and is a reasonable work around for a very longstanding awkward interface.
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
(cherry picked from commit
557857cf2c881fb7beec2019d3c85cef893c5342)
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>