backporting virtual field support from acq branch
[Evergreen.git] / Open-ILS / web / js / dojo / fieldmapper / hash.js
index 333a2d9..d3a6256 100644 (file)
@@ -29,7 +29,7 @@ if(!dojo._hasResource['fieldmapper.hash']){
                return this;
        }
 
-       function _toHash (includeNulls) {
+       function _toHash (includeNulls, virtFields) {
                var _hash = {};
                for ( var i=0; i < this._fields.length; i++) {
                        if (includeNulls || this[this._fields[i]]() != null) {
@@ -39,6 +39,14 @@ if(!dojo._hasResource['fieldmapper.hash']){
                                    _hash[this._fields[i]] = '' + this[this._fields[i]]();
             }
                }
+
+               if (virtFields && virtFields.length > 0) {
+                       for (var i in virtFields) {
+                               if (!_hash[virtFields[i]])
+                                       _hash[virtFields[i]] = null;
+                       }
+               }
+
                return _hash;
        }