details:   https://code.openbravo.com/erp/devel/main/rev/52742b2346be
changeset: 20508:52742b2346be
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Jun 04 10:20:19 2013 +0200
summary:   Fixes issue 23975: Number handling works using ',' as decimal 
separator

In the fix of the issue 23758 [1] it was wrongly assumed that the function 
getValue() of a OBNumberItem was going to return a javascript number. When the 
an existing record has just been opened getValue() will return a number, but 
when the user edits it, it will return the string representation of the number 
using the format specified by the user.

Now this has been taken into account, so the value is treated differently if 
getValue returns a string or a javascript number.

[1] 
https://code.openbravo.com/erp/devel/pi/rev/2e4eccaa3cc8fc8ac434cb0d386166558d1ee686

details:   https://code.openbravo.com/erp/devel/main/rev/51f380c29321
changeset: 20509:51f380c29321
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Tue Jun 04 12:33:00 2013 +0200
summary:   Fixes issue 23975: Changes are only done when getValue() returns a 
string

The numeric handling only needed to be done when getValue() returns a string, 
that is, when the user has entered a new value or modified the existing one. 
The textualValue needed to be set also.

details:   https://code.openbravo.com/erp/devel/main/rev/f7a3e45cbddf
changeset: 20510:f7a3e45cbddf
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Jun 05 12:36:15 2013 +0200
summary:   Fixes issue 23991: table_name column of ad_table table is mandatory 
again

At one point durint the development of the Datasource Based Tables project the 
table_name column of the ad_table table was set not mandatory, because this 
field was meant to be left empty for tables based on datasources. Later in the 
project it was decided to use the column 'name' (the name column of the Table 
table) to set the 'table_name' column for datasource based tables. This was we 
avoided having to change the table identifier (table_name).

After this change the table_name column must be mandatory in the database.

details:   https://code.openbravo.com/erp/devel/main/rev/e426b7ccc826
changeset: 20511:e426b7ccc826
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Jun 05 14:03:22 2013 +0200
summary:   Fixes issue 23996: An event handler has been replaced with database 
constraints

The event handler TableDataOriginEventHandler has been replaced with database 
constraints. This is a better approach because it is simpler and easier to maint
ain.

The name of two of the messages has been updated so that it is the name as the 
constraint that throw them. The message used to warn the user that the 
table_name must be set if the data origin is 'Table' has been removed because 
now the table_name is mandatory again in the database.

details:   https://code.openbravo.com/erp/devel/main/rev/02b4db5308b3
changeset: 20512:02b4db5308b3
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Jun 05 15:57:57 2013 +0200
summary:   Fixes issue 23996: String is compared in constraint after being 
upper cased

diffstat:

 
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableDataOriginEventHandler.java
 |  73 ----------
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
 |   9 +-
 src-db/database/model/tables/AD_TABLE.xml                                      
                                      |   4 +-
 src-db/database/sourcedata/AD_MESSAGE.xml                                      
                                      |  16 +-
 4 files changed, 12 insertions(+), 90 deletions(-)

diffs (157 lines):

diff -r 31f9b82dde77 -r 02b4db5308b3 
modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableDataOriginEventHandler.java
--- 
a/modules/org.openbravo.client.application/src/org/openbravo/client/application/event/TableDataOriginEventHandler.java
      Sat Jun 01 01:56:07 2013 +0200
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- *************************************************************************
- * The contents of this file are subject to the Openbravo  Public  License
- * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
- * Version 1.1  with a permitted attribution clause; you may not  use this
- * file except in compliance with the License. You  may  obtain  a copy of
- * the License at http://www.openbravo.com/legal/license.html
- * Software distributed under the License  is  distributed  on  an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
- * License for the specific  language  governing  rights  and  limitations
- * under the License.
- * The Original Code is Openbravo ERP.
- * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2013 Openbravo SLU
- * All Rights Reserved.
- * Contributor(s):  Augusto Mauch.
- ************************************************************************
- */
-
-package org.openbravo.client.application.event;
-
-import javax.enterprise.event.Observes;
-
-import org.apache.log4j.Logger;
-import org.openbravo.base.exception.OBException;
-import org.openbravo.base.model.Entity;
-import org.openbravo.base.model.ModelProvider;
-import org.openbravo.client.application.ApplicationConstants;
-import org.openbravo.client.kernel.event.EntityPersistenceEventObserver;
-import org.openbravo.client.kernel.event.EntityUpdateEvent;
-import org.openbravo.dal.core.OBContext;
-import org.openbravo.database.ConnectionProvider;
-import org.openbravo.erpCommon.utility.Utility;
-import org.openbravo.model.ad.datamodel.Table;
-import org.openbravo.service.datasource.DataSource;
-import org.openbravo.service.db.DalConnectionProvider;
-
-public class TableDataOriginEventHandler extends 
EntityPersistenceEventObserver {
-
-  private static Entity[] entities = { 
ModelProvider.getInstance().getEntity(Table.ENTITY_NAME) };
-  protected Logger logger = Logger.getLogger(this.getClass());
-
-  @Override
-  protected Entity[] getObservedEntities() {
-    return entities;
-  }
-
-  public void onUpdate(@Observes EntityUpdateEvent event) {
-    if (!isValidEvent(event)) {
-      return;
-    }
-    final Table table = (Table) event.getTargetInstance();
-    String dataOriginType = table.getDataOriginType();
-    String tableName = table.getDBTableName();
-    String javaClassName = table.getJavaClassName();
-    DataSource datasource = table.getObserdsDatasource();
-    if (ApplicationConstants.TABLEBASEDTABLE.equals(dataOriginType) && 
(tableName == null)) {
-      String language = OBContext.getOBContext().getLanguage().getLanguage();
-      ConnectionProvider conn = new DalConnectionProvider(false);
-      throw new OBException(Utility.messageBD(conn, 
"OBUIAPP_TableNameMandatory", language));
-    }
-    if (ApplicationConstants.TABLEBASEDTABLE.equals(dataOriginType) && 
(javaClassName == null)) {
-      String language = OBContext.getOBContext().getLanguage().getLanguage();
-      ConnectionProvider conn = new DalConnectionProvider(false);
-      throw new OBException(Utility.messageBD(conn, 
"OBUIAPP_JavaClassNameMandatory", language));
-    }
-    if (ApplicationConstants.DATASOURCEBASEDTABLE.equals(dataOriginType) && 
(datasource == null)) {
-      String language = OBContext.getOBContext().getLanguage().getLanguage();
-      ConnectionProvider conn = new DalConnectionProvider(false);
-      throw new OBException(Utility.messageBD(conn, 
"OBUIAPP_DatasourceMandatory", language));
-    }
-  }
-}
diff -r 31f9b82dde77 -r 02b4db5308b3 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
      Sat Jun 01 01:56:07 2013 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-number.js
      Wed Jun 05 15:57:57 2013 +0200
@@ -432,8 +432,13 @@
     var value, roundedValue, textRoundedValue;
 
     // Make sure the number is rounded using the number of decimal digits 
specified in the number typeInstance
-    value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(), 
this.typeInstance.maskNumeric, this.typeInstance.decSeparator, 
this.typeInstance.groupSeparator);
-    this.setValue(OB.Utilities.Number.OBMaskedToJS(value));
+    if (isc.isA.String(this.getValue())) {
+        value = OB.Utilities.Number.OBPlainToOBMasked(this.getValue(), 
this.typeInstance.maskNumeric, this.typeInstance.decSeparator, 
this.typeInstance.groupSeparator);
+        this.setValue(OB.Utilities.Number.OBMaskedToJS(value, 
this.typeInstance.decSeparator, this.typeInstance.groupSeparator));
+        if (this.form.setTextualValue) {
+            this.form.setTextualValue(this.name, value, this.typeInstance);
+        }
+    }
 
     if (this.grid && this.grid.isEditing && this.grid.isEditing()) {
       this.grid.setEditValue(this.grid.getEditRow(), this.name, 
this.getValue(), true, true);
diff -r 31f9b82dde77 -r 02b4db5308b3 src-db/database/model/tables/AD_TABLE.xml
--- a/src-db/database/model/tables/AD_TABLE.xml Sat Jun 01 01:56:07 2013 +0200
+++ b/src-db/database/model/tables/AD_TABLE.xml Wed Jun 05 15:57:57 2013 +0200
@@ -45,7 +45,7 @@
         <default/>
         <onCreateDefault/>
       </column>
-      <column name="TABLENAME" primaryKey="false" required="false" 
type="VARCHAR" size="40" autoIncrement="false">
+      <column name="TABLENAME" primaryKey="false" required="true" 
type="VARCHAR" size="40" autoIncrement="false">
         <default/>
         <onCreateDefault/>
       </column>
@@ -167,6 +167,8 @@
       <unique name="AD_TABLE_TREETYPE_UN">
         <unique-column name="TREETYPE"/>
       </unique>
+      <check name="AD_TABLE_CLASSNAME_CHK"><![CDATA[(UPPER((DATAORIGINTYPE)) = 
'DATASOURCE') OR (CLASSNAME IS NOT NULL)]]></check>
+      <check name="AD_TABLE_DATASOURCE_CHK"><![CDATA[(UPPER((DATAORIGINTYPE)) 
= 'TABLE') OR (OBSERDS_DATASOURCE_ID IS NOT NULL)]]></check>
       <check name="AD_TABLE_ISACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 
'N')]]></check>
       <check name="AD_TABLE_ISAUDITINS_CHK"><![CDATA[ISAUDITINSERTS IN ('Y', 
'N')]]></check>
       <check name="AD_TABLE_ISDELETEABLE_CHK"><![CDATA[ISDELETEABLE IN ('Y', 
'N')]]></check>
diff -r 31f9b82dde77 -r 02b4db5308b3 src-db/database/sourcedata/AD_MESSAGE.xml
--- a/src-db/database/sourcedata/AD_MESSAGE.xml Sat Jun 01 01:56:07 2013 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Jun 05 15:57:57 2013 +0200
@@ -17145,18 +17145,6 @@
 <!--2413C331A08B4F3F98FC3F9A0F2A636C-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--2413C331A08B4F3F98FC3F9A0F2A636C--></AD_MESSAGE>
 
-<!--2445F46096B344E1AB2EBB0CDF9D94EE--><AD_MESSAGE>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  
<AD_MESSAGE_ID><![CDATA[2445F46096B344E1AB2EBB0CDF9D94EE]]></AD_MESSAGE_ID>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  
<VALUE><![CDATA[OBUIAPP_TableNameMandatory]]></VALUE>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  <MSGTEXT><![CDATA[If the data origin 
type is 'Table' then the Table Name field is mandatory and cannot be left 
empty.]]></MSGTEXT>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE-->  
<ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
-<!--2445F46096B344E1AB2EBB0CDF9D94EE--></AD_MESSAGE>
-
 <!--24B4AED8FE3542C2933B4EA37DF641C5--><AD_MESSAGE>
 <!--24B4AED8FE3542C2933B4EA37DF641C5-->  
<AD_MESSAGE_ID><![CDATA[24B4AED8FE3542C2933B4EA37DF641C5]]></AD_MESSAGE_ID>
 <!--24B4AED8FE3542C2933B4EA37DF641C5-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -18919,7 +18907,7 @@
 <!--58FF541F93764CF686479AF658451270-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--58FF541F93764CF686479AF658451270-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--58FF541F93764CF686479AF658451270-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--58FF541F93764CF686479AF658451270-->  
<VALUE><![CDATA[OBUIAPP_DatasourceMandatory]]></VALUE>
+<!--58FF541F93764CF686479AF658451270-->  
<VALUE><![CDATA[ad_table_datasource_chk]]></VALUE>
 <!--58FF541F93764CF686479AF658451270-->  <MSGTEXT><![CDATA[If the data origin 
type is 'Datasource' then the Datasource field is mandatory and cannot be left 
empty. ]]></MSGTEXT>
 <!--58FF541F93764CF686479AF658451270-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--58FF541F93764CF686479AF658451270-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
@@ -19715,7 +19703,7 @@
 <!--707E11D58E994C75B7745103E95B9DBA-->  
<AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--707E11D58E994C75B7745103E95B9DBA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--707E11D58E994C75B7745103E95B9DBA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--707E11D58E994C75B7745103E95B9DBA-->  
<VALUE><![CDATA[OBUIAPP_JavaClassNameMandatory]]></VALUE>
+<!--707E11D58E994C75B7745103E95B9DBA-->  
<VALUE><![CDATA[ad_table_classname_chk]]></VALUE>
 <!--707E11D58E994C75B7745103E95B9DBA-->  <MSGTEXT><![CDATA[If the data origin 
type is 'Table' then the Java Class Name field is mandatory and cannot be left 
empty.]]></MSGTEXT>
 <!--707E11D58E994C75B7745103E95B9DBA-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
 <!--707E11D58E994C75B7745103E95B9DBA-->  
<AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to