fix OPAC visible cosmetic bug for stat cats in staff client. Bitten again by JSON...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 10 Jun 2009 10:09:21 +0000 (10:09 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 10 Jun 2009 10:09:21 +0000 (10:09 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13359 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/server/admin/stat_cat_editor.js
Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul

index 3ddb3d9..f3cbb4d 100644 (file)
        }
 
        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;
        }
 
index 3262493..b67326c 100644 (file)
@@ -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; }
index 52e72ed..0b6cbd0 100644 (file)
                                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'));
                                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'));