details:   https://code.openbravo.com/erp/devel/pi/rev/b67d11a30224
changeset: 13246:b67d11a30224
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Wed Jul 20 18:41:24 2011 +0200
summary:   Fixes issue 0017846: Multicurrency - finacc_txn_convert_rate numeric 
field in the DB is showing more than 6 characters
It has been formatted-parsed the data that comes from callout to fix the number 
of decimals according the field properties

details:   https://code.openbravo.com/erp/devel/pi/rev/a89603e59074
changeset: 13247:a89603e59074
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Thu Jul 21 15:35:12 2011 +0200
summary:   Fixes issue 0017846: Multicurrency - finacc_txn_convert_rate numeric 
field in the DB is showing more than 6 characters
It has been formatted-parsed the data that comes from callout to fix the number 
of decimals according the field properties

details:   https://code.openbravo.com/erp/devel/pi/rev/56151e1a260f
changeset: 13248:56151e1a260f
user:      Adrián Romero <adrianromero <at> openbravo.com>
date:      Fri Jul 22 09:48:20 2011 +0200
summary:   Fixes issue 0017846: Multicurrency - finacc_txn_convert_rate numeric 
field in the DB is showing more than 6 characters
Moved var declarations to the begining of the function to follow style guide

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
 |  38 +++++++--
 1 files changed, 29 insertions(+), 9 deletions(-)

diffs (91 lines):

diff -r 7dc5b024cf94 -r 56151e1a260f 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Fri Jul 22 07:20:05 2011 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js
     Fri Jul 22 09:48:20 2011 +0200
@@ -759,6 +759,10 @@
   },
   
   processColumnValue: function(columnName, columnValue, editValues){
+       // Modifications in this method should go also in 
setColumnValuesInEditValues because both almost do the same
+    var typeInstance;
+    var assignValue;
+    var assignClassicValue;
     var isDate, i, valueMap = {}, oldValue, field = 
this.getFieldFromColumnName(columnName), entries = columnValue.entries;
     // not a field on the form, probably a datasource field
     var prop = this.view.getPropertyFromDBColumnName(columnName);
@@ -790,7 +794,15 @@
       editValues[prop + '._valueMap'] = field.valueMap;
     }
     
+    // Adjust to formatting if exists value and classicValue. 
     oldValue = this.getValue(field.name);
+    if (field.typeInstance && field.typeInstance.parseInput && 
field.typeInstance.editFormatter) {
+       assignValue = 
field.typeInstance.parseInput(field.typeInstance.editFormatter(columnValue.value));
+       assignClassicValue = 
field.typeInstance.editFormatter(field.typeInstance.parseInput(columnValue.classicValue));
+    } else {
+       assignValue = columnValue.value;
+       assignClassicValue = columnValue.classicValue;
+    }
     
     if (columnValue.value && (columnValue.value === 'null' || 
columnValue.value === '')) {
       // handle the case that the FIC returns a null value as a string
@@ -835,7 +847,7 @@
           }
         }
         
-        this.setValue(field.name, columnValue.value);
+        this.setValue(field.name, assignValue);
       }
     } else {
       // note: do not use clearvalue as this removes the value from the form
@@ -851,15 +863,17 @@
     }
     
     // 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);
-      }
+    typeInstance = SimpleType.getType(field.type);
+    if (columnValue.classicValue && typeInstance.decSeparator) {
+      this.setTextualValue(field.name, assignClassicValue, typeInstance);
     }
   },
   
   setColumnValuesInEditValues: function(columnName, columnValue, editValues){
+       // Modifications in this method should go also in processColumnValue 
because both almost do the same
+       var assignClassicValue;
+       var typeInstance;
+
     // no editvalues even anymore, go away
     if (!editValues) {
       return;
@@ -881,7 +895,7 @@
       }
       editValues[prop + '._valueMap'] = valueMap;
     }
-    
+
     if (columnValue.value && (columnValue.value === 'null' || 
columnValue.value === '')) {
       // handle the case that the FIC returns a null value as a string
       // should be repaired in the FIC
@@ -913,11 +927,17 @@
       editValues[prop] = null;
     }
     
+
+
     // store the textualvalue so that it is correctly send back to the server
     if (field) {
-      var typeInstance = SimpleType.getType(field.type);
+      // Adjust to formatting if exists value and classicValue.
+      assignClassicValue = (field.typeInstance && 
field.typeInstance.parseInput && field.typeInstance.editFormatter)
+        ? 
field.typeInstance.editFormatter(field.typeInstance.parseInput(columnValue.classicValue))
+        : columnValue.classicValue;
+      typeInstance = SimpleType.getType(field.type);
       if (columnValue.classicValue && typeInstance.decSeparator) {
-        this.setTextualValue(field.name, columnValue.classicValue, 
typeInstance, editValues);
+        this.setTextualValue(field.name, assignClassicValue, typeInstance, 
editValues);
       }
     }
   },

------------------------------------------------------------------------------
10 Tips for Better Web Security
Learn 10 ways to better secure your business today. Topics covered include:
Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
security Microsoft Exchange, secure Instant Messaging, and much more.
http://www.accelacomm.com/jaw/sfnl/114/51426210/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to