From: phasefx Date: Wed, 10 Jun 2009 10:09:21 +0000 (+0000) Subject: fix OPAC visible cosmetic bug for stat cats in staff client. Bitten again by JSON... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=12207b4a1c225d8db332fe9f3cbc3697155231ba;p=evergreen%2Ftadl.git fix OPAC visible cosmetic bug for stat cats in staff client. Bitten again by JSON returning '0' instead of 0 git-svn-id: svn://svn.open-ils.org/ILS/trunk@13359 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index 3ddb3d94fb..f3cbb4ded8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -168,10 +168,11 @@ } function get_bool(a) { - // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false - // So false includes 'f', '', 0, null, and undefined + // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false, and '0' == false (newer JSON is returning '0' instead of 0 in cases) + // So false includes 'f', '', '0', 0, null, and undefined if (a == 'f') return false; if (a == 'F') return false; + if (a == '0') return false; if (a) return true; else return false; } diff --git a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js index 3262493ee7..b67326cec5 100644 --- a/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js +++ b/Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js @@ -158,7 +158,7 @@ function scInsertCat( tbody, cat, type ) { $n(row, 'sc_edit').onclick = function(){ scEdit(tbody, type, cat); }; $n(row, 'sc_owning_lib').appendChild( text( findOrgUnit(cat.owner()).name() )); - if( cat.opac_visible() ) unHideMe($n(row, 'sc_opac_visible')); + if( cat.opac_visible() != 0 && cat.opac_visible() != '0' ) unHideMe($n(row, 'sc_opac_visible')); else unHideMe($n(row, 'sc_opac_invisible')); tbody.appendChild(row); @@ -324,7 +324,7 @@ function scEdit( tbody, type, cat ) { name.focus(); name.select(); - if( cat.opac_visible() ) { + if( cat.opac_visible() != 0 && cat.opac_visible() != '0' ) { $n( $n(row, 'sc_edit_opac_vis'), 'sc_edit_opac_visibility').checked = true; } else { @@ -359,7 +359,7 @@ function scEditGo( type, cat, row, selector ) { if(!name) return false; var isvisible = false; - if( cat.opac_visible() ) isvisible = true; + if( cat.opac_visible() != 0 && cat.opac_visible() != '0' ) isvisible = true; if( (name == cat.name()) && (visible == isvisible) && (newlib == cat.owner()) ) { return true; } diff --git a/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul b/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul index 52e72edf1b..0b6cbd0cd2 100644 --- a/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul +++ b/Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul @@ -107,7 +107,7 @@ sp.appendChild(actsc_node); actsc_node.hidden = false; apply(actsc_node,'name',my_actsc[i].name()); - if (my_actsc[i].opac_visible()) { + if (get_bool(my_actsc[i].opac_visible())) { apply(actsc_node, 'opac', $("patronStrings").getString('staff.patron.info_stat_cats.render_stat_cats.opac_visible')); } else { apply(actsc_node, 'opac', $("patronStrings").getString('staff.patron.info_stat_cats.render_stat_cats.not_opac_visible')); @@ -146,7 +146,7 @@ actsc_node.hidden = false; apply(actsc_node,'name',sc.name()); - if (sc.opac_visible()) { + if (get_bool(sc.opac_visible())) { apply(actsc_node, 'opac', $("patronStrings").getString('staff.patron.info_stat_cats.render_stat_cats.opac_visible')); } else { apply(actsc_node, 'opac', $("patronStrings").getString('staff.patron.info_stat_cats.render_stat_cats.not_opac_visible'));