backporting virtual field support from acq branch
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Jul 2008 15:04:05 +0000 (15:04 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 24 Jul 2008 15:04:05 +0000 (15:04 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10112 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/dojo/fieldmapper/dojoData.js
Open-ILS/web/js/dojo/fieldmapper/hash.js

index a0ab494..3e5a1ad 100644 (file)
@@ -48,7 +48,7 @@ if(!dojo._hasResource['fieldmapper.dojoData']){
 
                var data = { label : label, identifier : params.identifier, items : [] };
 
-               for (var i in list) data.items.push( list[i].toHash(true) );
+               for (var i in list) data.items.push( list[i].toHash(true, params.virtualFields) );
 
                if (params.children && params.parent) {
                        var _hash_list = data.items;
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;
        }