LP#820409 fix org unit admin UI
authorJason Etheridge <jason@esilibrary.com>
Mon, 15 Aug 2011 19:34:07 +0000 (15:34 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 16 Aug 2011 13:12:48 +0000 (09:12 -0400)
This reverts part of 17e659eec3e23caf5d301b33aa5019b672ecd0e8, which was
tightening checks against null and '' to avoid implicit type-casting.

This line var modified_ou = new aou().fromStoreItem( current_ou ); was
producing a fieldmapper object where certain fields were being set to
contain the string "undefined" rather than a null.

The update method would take isdeleted == "undefined" as True.

Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/web/js/dojo/fieldmapper/Fieldmapper.js

index df8b73b..006bd09 100644 (file)
@@ -223,7 +223,7 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
     //** FROM HASH **/
     function _fromHash (_hash) {
         for ( var i=0; i < this._fields.length; i++) {
-            if (_hash[this._fields[i]] !== null)
+            if (_hash[this._fields[i]] != null)
                 this[this._fields[i]]( _hash[this._fields[i]] );
         }
         return this;
@@ -233,8 +233,8 @@ if(!dojo._hasResource["fieldmapper.Fieldmapper"]){
         var _hash = {};
         var i;
         for (i=0; i < this._fields.length; i++) {
-            if (includeNulls || this[this._fields[i]]() !== null) {
-                if (this[this._fields[i]]() === null)
+            if (includeNulls || this[this._fields[i]]() != null) {
+                if (this[this._fields[i]]() == null)
                     _hash[this._fields[i]] = null;
                 else
                     _hash[this._fields[i]] = '' + this[this._fields[i]]();