details: /erp/devel/pi/rev/332e17a26a30
changeset: 11576:332e17a26a30
user: Martin Taal <martin.taal <at> openbravo.com>
date: Thu Apr 14 06:28:20 2011 +0200
summary: Fix obvious javascript error when refreshing
details: /erp/devel/pi/rev/a3d7655c758f
changeset: 11577:a3d7655c758f
user: Martin Taal <martin.taal <at> openbravo.com>
date: Thu Apr 14 06:28:51 2011 +0200
summary: Fixes issue 16789: What you enter through the ERP it is different
from what it is stored in the DB
diffstat:
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
| 8 ++
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
| 2 +-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
| 35 +++++++++-
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
| 2 +-
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
| 9 ++-
5 files changed, 51 insertions(+), 5 deletions(-)
diffs (136 lines):
diff -r 7937ca8bf655 -r a3d7655c758f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Wed Apr 13 18:01:57 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
Thu Apr 14 06:28:51 2011 +0200
@@ -1072,6 +1072,14 @@
return this.Super('init', arguments);
},
+ // after a change also store the textual value in the form
+ // for precision, the textual value is sent to the server
+ // which can be transferred to a bigdecimal there
+ changed: function (form, item, value) {
+ this.form.setTextualValue(this.name, this.getEnteredValue(),
this.typeInstance);
+ this.Super('changed', arguments);
+ },
+
getMaskNumeric: function(){
return this.typeInstance.maskNumeric;
},
diff -r 7937ca8bf655 -r a3d7655c758f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Wed Apr 13 18:01:57 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-standard-view.js
Thu Apr 14 06:28:51 2011 +0200
@@ -1270,7 +1270,7 @@
if (this.viewForm.hasChanged) {
var callback = function(ok){
if (ok) {
- this.viewGrid.refreshGrid(formRefresh);
+ view.viewGrid.refreshGrid(formRefresh);
}
};
isc.ask(OB.I18N.getLabel('OBUIAPP_ConfirmRefresh'), callback);
diff -r 7937ca8bf655 -r a3d7655c758f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Wed Apr 13 18:01:57 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form.js
Thu Apr 14 06:28:51 2011 +0200
@@ -452,6 +452,7 @@
if (!data || !data.columnValues) {
this.setDisabled(false);
this.validate();
+ delete this.inFicCall;
return;
}
@@ -673,6 +674,14 @@
// which results it to not be sent to the server anymore
this.setValue(field.name, null);
}
+
+ // store the textualvalue so that it is correctly send back to the server
+ if (field) {
+ var typeInstance = SimpleType.getType(field.type);
+ if (columnValue.classicValue && typeInstance.decSeparator) {
+ this.setTextualValue(field.name, columnValue.classicValue,
typeInstance);
+ }
+ }
},
setColumnValuesInEditValues: function(columnName, columnValue, editValues){
@@ -727,9 +736,33 @@
// note: do not use clearvalue as this removes the value from the form
// which results it to not be sent to the server anymore
editValues[prop] = null;
- }
+ }
+
+ // store the textualvalue so that it is correctly send back to the server
+ if (field) {
+ var typeInstance = SimpleType.getType(field.type);
+ if (columnValue.classicValue && typeInstance.decSeparator) {
+ this.setTextualValue(field.name, columnValue.classicValue,
typeInstance, editValues);
+ }
+ }
},
+ // note textValue is in user format using users decimal and group separator
+ setTextualValue: function(fldName, textValue, type, editValues) {
+ if (!textValue || textValue.trim() === '') {
+ textValue = '';
+ } else {
+ textValue = OB.Utilities.Number.OBMaskedToOBPlain(textValue,
type.decSeparator, type.groupSeparator);
+ textValue = textValue.replace(type.decSeparator, '.');
+ }
+ if (editValues) {
+ editValues[fldName + '_textualValue'] = textValue;
+ } else if (this.grid) {
+ this.grid.getEditValues(this.grid.getEditRow())[fldName +
'_textualValue'] = textValue;
+ }
+ this.setValue(fldName + '_textualValue', textValue);
+ },
+
// called explicitly onblur and when non-editable fields change
handleItemChange: function(item){
diff -r 7937ca8bf655 -r a3d7655c758f
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
---
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Wed Apr 13 18:01:57 2011 +0200
+++
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
Thu Apr 14 06:28:51 2011 +0200
@@ -1468,7 +1468,7 @@
}
return ret;
},
-
+
// check if a fic call needs to be done when leaving a cell and moving to
the next
// row
// see description in saveEditvalues
diff -r 7937ca8bf655 -r a3d7655c758f
modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
---
a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
Wed Apr 13 18:01:57 2011 +0200
+++
b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonToDataConverter.java
Thu Apr 14 06:28:51 2011 +0200
@@ -40,6 +40,7 @@
import org.openbravo.base.exception.OBException;
import org.openbravo.base.model.Entity;
import org.openbravo.base.model.Property;
+import org.openbravo.base.model.domaintype.BigDecimalDomainType;
import org.openbravo.base.model.domaintype.EncryptedStringDomainType;
import org.openbravo.base.model.domaintype.HashedStringDomainType;
import org.openbravo.base.model.domaintype.TimestampDomainType;
@@ -395,6 +396,10 @@
} else {
// no _cleartext value found -> skipping field
}
+ } else if (property.getDomainType() instanceof BigDecimalDomainType
+ && jsonObject.has(keyName + "_textualValue")) {
+ setValue(obObject, property,
+ new BigDecimal((String) jsonObject.get(keyName +
"_textualValue")));
} else {
setValue(obObject, property, jsonObject.get(keyName));
}
@@ -635,8 +640,8 @@
// there are mismatches between json and the database in
// precision of times/dates, these are repaired here by
// not updating if the relevant part is the same
- if (areDatesEqual((Date) value, (Date) currentValue,
property.isDatetime(), property
- .getDomainType() instanceof TimestampDomainType)) {
+ if (areDatesEqual((Date) value, (Date) currentValue,
property.isDatetime(),
+ property.getDomainType() instanceof TimestampDomainType)) {
return;
}
}
------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve
application availability and disaster protection. Learn more about boosting
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits