diff --git a/o2web/source/x_component_process_Xform/Org.js b/o2web/source/x_component_process_Xform/Org.js index 9993ea717e9cfed4cddce8fed21d820e04fccf73..069c78ad6d48a0358b8f80c94bcc1adb37b37a1d 100644 --- a/o2web/source/x_component_process_Xform/Org.js +++ b/o2web/source/x_component_process_Xform/Org.js @@ -93,12 +93,15 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({ _computeValue: function(){ + var simple = this.json.storeRange === "simple"; var values = []; if (this.json.identityValue) { - this.json.identityValue.each(function(v){ if (v) values.push(v)}); + this.json.identityValue.each(function(v){ + if (v) values.push(MWF.org.parseOrgData(v, true, simple)) + }); } if (this.json.unitValue) { - this.json.unitValue.each(function(v){ if (v) values.push(v)}); + this.json.unitValue.each(function(v){ if (v) values.push(MWF.org.parseOrgData(v, true, simple))}); } if (this.json.dutyValue) { var dutys = JSON.decode(this.json.dutyValue); @@ -109,7 +112,7 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({ var code = "return this.org.getDuty(\""+duty.name+"\", \""+par+"\")"; var d = this.form.Macro.exec(code, this); if (typeOf(d)!=="array") d = (d) ? [d.toString()] : []; - d.each(function(dd){if (dd) values.push(dd);}); + d.each(function(dd){if (dd) values.push(MWF.org.parseOrgData(dd, true, simple));}); }.bind(this)); } } @@ -120,7 +123,7 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({ if (fdd){ if (typeOf(fdd)==="string"){ var data; - this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false); + this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = MWF.org.parseOrgData(json.data, true, simple); }.bind(this), null, fdd, false); values.push(data); }else{ values.push(fdd); @@ -695,15 +698,17 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({ }, addData: function(value){ if (!value) return false; + var simple = this.json.storeRange === "simple"; value.each(function(v){ var vtype = typeOf(v); if (vtype==="string"){ var data; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), null, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true, simple); }.bind(this), null, v, false); if (data) this.combox.addNewValue(this.getDataText(data), data); } if (vtype==="object"){ - this.combox.addNewValue(this.getDataText(v), v); + var d = MWF.org.parseOrgData(v, true, simple); + this.combox.addNewValue(this.getDataText(d), d); } }.bind(this)); }, @@ -854,33 +859,36 @@ MWF.xApplication.process.Xform.Org = MWF.APPOrg = new Class({ var values = []; var comboxValues = []; var type = typeOf(value); + var simple = this.json.storeRange === "simple"; if (type==="array"){ value.each(function(v){ var data=null; var vtype = typeOf(v); if (vtype==="string"){ var error = (this.json.isInput) ? function(){ comboxValues.push(v); } : null; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), error, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true, simple); }.bind(this), error, v, false); } if (vtype==="object") data = v; if (data){ - values.push(data); - comboxValues.push({"text": this.getDataText(data),"value": data}); + var d = MWF.org.parseOrgData(data, true, simple) + values.push(d); + comboxValues.push({"text": this.getDataText(d),"value": d}); } }.bind(this)); } if (type==="string"){ var vData; var error = (this.json.isInput) ? function(){ comboxValues.push(value); } : null; - this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = json.data }.bind(this), error, value, false); + this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true,simple); }.bind(this), error, value, false); if (vData){ values.push(vData); comboxValues.push({"text": this.getDataText(vData),"value": vData}); } } if (type==="object"){ - values.push(value); - comboxValues.push({"text": this.getDataText(value),"value": value}); + var v = MWF.org.parseOrgData(value, true, simple) + values.push(v); + comboxValues.push({"text": this.getDataText(v),"value": v}); } this._setBusinessData(values); @@ -1884,4 +1892,4 @@ MWF.APPOrg.IdentityOptions = new Class({ } return rangeValues; } -}); \ No newline at end of file +}); diff --git a/o2web/source/x_component_process_Xform/Orgfield.js b/o2web/source/x_component_process_Xform/Orgfield.js index 2af9ec4d8ae588bcfc97c11323d6812e582f8ca3..2fde20c96d0b80fc7bfba25d4c35ab8c2bfd222a 100644 --- a/o2web/source/x_component_process_Xform/Orgfield.js +++ b/o2web/source/x_component_process_Xform/Orgfield.js @@ -311,7 +311,7 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({ var vtype = typeOf(v); if (vtype==="string"){ var data; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), null, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), null, v, false); if (data) this.combox.addNewValue(this.getDataText(data), data); } if (vtype==="object"){ @@ -337,7 +337,7 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({ if (fdd){ if (typeOf(fdd)==="string"){ var data; - this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false); + this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), null, fdd, false); values.push(data); }else{ values.push(fdd); @@ -418,7 +418,7 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({ var vtype = typeOf(v); if (vtype==="string"){ var error = (this.json.isInput) ? function(){ comboxValues.push(v); } : null; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), error, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true); }.bind(this), error, v, false); } if (vtype==="object") data = v; if (data){ @@ -430,7 +430,7 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({ if (type==="string"){ var vData; var error = (this.json.isInput) ? function(){ comboxValues.push(value); } : null; - this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = json.data }.bind(this), error, value, false); + this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true); }.bind(this), error, value, false); if (vData){ values.push(vData); comboxValues.push({"text": this.getDataText(vData),"value": vData}); @@ -605,4 +605,4 @@ MWF.xApplication.process.Xform.Orgfield = MWF.APPOrgfield = new Class({ } } } -}); \ No newline at end of file +}); diff --git a/o2web/source/x_component_process_Xform/Personfield.js b/o2web/source/x_component_process_Xform/Personfield.js index 966eda25bdf0f0b73399a47c8bf1d0547d1b755a..c2584ec8ff61319ab93311d4f09c3cffa2f272e9 100644 --- a/o2web/source/x_component_process_Xform/Personfield.js +++ b/o2web/source/x_component_process_Xform/Personfield.js @@ -156,6 +156,8 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ if (this.json.unitValue) { this.json.unitValue.each(function(v){ if (v) values.push(v)}); } + var simple = this.json.storeRange === "simple"; + if (this.json.dutyValue) { var dutys = JSON.decode(this.json.dutyValue); var par; @@ -167,7 +169,9 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ //var code = "return this.org.getDepartmentDuty({\"name\": \""+duty.name+"\", \"departmentName\": \""+par+"\"})"; var d = this.form.Macro.exec(code, this); if (typeOf(d)!=="array") d = (d) ? [d.toString()] : []; - d.each(function(dd){if (dd) values.push(dd);}); + d.each(function(dd){ + if (dd) values.push(MWF.org.parseOrgData(dd,true,simple)); + }); // code = "return this.org.getCompanyDuty({\"name\": \""+duty.name+"\", \"compName\": \""+par+"\"})"; // d = this.form.Macro.exec(code, this); @@ -183,7 +187,7 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ if (fdd){ if (typeOf(fdd)==="string"){ var data; - this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = json.data }.bind(this), null, fdd, false); + this.getOrgAction()[this.getValueMethod(fdd)](function(json){ data = MWF.org.parseOrgData(json.data,true, simple); }.bind(this), null, fdd, false); values.push(data); }else{ values.push(fdd); @@ -625,11 +629,12 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ }, addData: function(value){ if (!value) return false; + var simple = this.json.storeRange === "simple"; value.each(function(v){ var vtype = typeOf(v); if (vtype==="string"){ var data; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), null, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true, simple); }.bind(this), null, v, false); if (data) this.combox.addNewValue(this.getDataText(data), data); } if (vtype==="object"){ @@ -788,13 +793,16 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ var values = []; var comboxValues = []; var type = typeOf(value); + + var simple = this.json.storeRange === "simple"; + if (type==="array"){ value.each(function(v){ var data=null; var vtype = typeOf(v); if (vtype==="string"){ var error = (this.json.isInput) ? function(){ comboxValues.push(v); } : null; - this.getOrgAction()[this.getValueMethod(v)](function(json){ data = json.data }.bind(this), error, v, false); + this.getOrgAction()[this.getValueMethod(v)](function(json){ data = MWF.org.parseOrgData(json.data, true, simple) }.bind(this), error, v, false); } if (vtype==="object") data = v; if (data){ @@ -806,7 +814,7 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ if (type==="string"){ var vData; var error = (this.json.isInput) ? function(){ comboxValues.push(value); } : null; - this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = json.data }.bind(this), error, value, false); + this.getOrgAction()[this.getValueMethod(value)](function(json){ vData = MWF.org.parseOrgData(json.data, true, simple) }.bind(this), error, value, false); if (vData){ values.push(vData); comboxValues.push({"text": this.getDataText(vData),"value": vData}); @@ -912,4 +920,4 @@ MWF.xApplication.process.Xform.Personfield = MWF.APPPersonfield = new Class({ } } -}); \ No newline at end of file +});