From a1e3acc60c00d5ab3f2ad57c30d04733904c08f7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 3 Apr 2013 15:50:49 -0300 Subject: [PATCH] Bug 9894 - (3.12) Small followup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Liz's patch adds the 'flagged' value back, but there's a problem with its logic that prevents it to work on startup (works fine for changing values) Regards To+ Sponsored-by: Universidad Nacional de Córdoba Signed-off-by: Bernardo Gonzalez Kriegel Signed-off-by: Jonathan Druart --- .../en/modules/admin/marc_subfields_structure.tt | 31 +++++++++----------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt index d27ba8b..6d7d011 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc_subfields_structure.tt @@ -35,6 +35,16 @@ $(document).ready(function() { } }*/ +/* Function to enable/disable hidden values checkboxes when Flag is (de)selected */ +function enable_cb(tab) { + if ($("#hidden_flagged_" + tab).is(':checked')) { + $('.inclusive_' + tab).attr('disabled',true).removeAttr('checked'); + } + else { + $('.inclusive_' + tab).removeAttr('disabled'); + } +} + /* Function to serialize and set the 'hidden' field */ function setHiddenValue() { @@ -46,20 +56,6 @@ function setHiddenValue() { var collapsed_checked = $("#hidden_collapsed_" + tab).is(':checked'); var hidden_value = ""; - $(function() { - enable_cb(); - $("#hidden_flagged_" + tab).click(enable_cb()); - }); - - function enable_cb() { - if ($("#hidden_flagged_" + tab).is(':checked')) { - $('.inclusive_' + tab).attr('disabled',true).removeAttr('checked'); - } - else { - $('.inclusive_' + tab).removeAttr('disabled'); - } - } - if ( flagged_checked ) { hidden_value='-8'; } else if ( opac_checked && ! intranet_checked && ! editor_checked && collapsed_checked ) { @@ -96,6 +92,8 @@ function setHiddenValue() { hidden_value='8'; } + enable_cb(tab); + $('#hidden-' + tab).val(hidden_value); } @@ -110,8 +108,6 @@ function populateHiddenCheckboxes(tab) { var collapsed_checked = false; var flagged_checked = false; - - if ( hidden_value == '-8' ) { flagged_checked = true; } else if ( hidden_value == '-7') { @@ -163,12 +159,13 @@ function populateHiddenCheckboxes(tab) { collapsed_checked = true; } // else if ( hidden_value == '8') { skip } - $("#hidden_opac_" + tab).attr('checked',opac_checked); $("#hidden_intranet_" + tab).attr('checked',intranet_checked); $("#hidden_editor_" + tab).attr('checked',editor_checked); $("#hidden_collapsed_" + tab).attr('checked',collapsed_checked); + $("#hidden_flagged_" + tab).attr('checked',flagged_checked); + enable_cb(tab); } -- 1.7.10.4