details:   https://code.openbravo.com/erp/devel/pi/rev/001f5b9e9d75
changeset: 20138:001f5b9e9d75
user:      Sandra Huguet <sandra.huguet <at> openbravo.com>
date:      Tue Apr 16 16:03:22 2013 +0200
summary:   Related to issue 23527 Fixed code in resetAccounting

diffstat:

 src/org/openbravo/financial/ResetAccounting.java |  36 ++---------------------
 1 files changed, 4 insertions(+), 32 deletions(-)

diffs (58 lines):

diff -r 319dfb6a0181 -r 001f5b9e9d75 
src/org/openbravo/financial/ResetAccounting.java
--- a/src/org/openbravo/financial/ResetAccounting.java  Tue Feb 19 09:32:10 
2013 +0530
+++ b/src/org/openbravo/financial/ResetAccounting.java  Tue Apr 16 16:03:22 
2013 +0200
@@ -30,6 +30,7 @@
 import org.hibernate.Query;
 import org.hibernate.criterion.Restrictions;
 import org.openbravo.base.exception.OBException;
+import org.openbravo.base.model.ModelProvider;
 import org.openbravo.dal.core.OBContext;
 import org.openbravo.dal.security.OrganizationStructureProvider;
 import org.openbravo.dal.service.OBCriteria;
@@ -209,7 +210,9 @@
     try {
       Table table = OBDal.getInstance().get(Table.class, tableId);
       tableName = table.getName();
-      tableDate = 
lowerCaseFirst(camelCaseIt(table.getAcctdateColumn().getName()));
+      tableDate = 
ModelProvider.getInstance().getEntityByTableName(table.getDBTableName())
+          
.getPropertyByColumnName(table.getAcctdateColumn().getDBColumnName()).getName();
+
       String strUpdate = "update "
           + tableName
           + " set posted='N', processNow=false where posted not in ('N','Y') 
and processed = 'Y' and organization.id in (:orgIds)  ";
@@ -454,35 +457,4 @@
     return exceptionDates.size() == validDates;
   }
 
-  private static String camelCaseIt(String mappingName) {
-    String localMappingName = mappingName.replaceAll("_", " ");
-    String separator = " ";
-    // strip _ at the end
-    while (localMappingName.endsWith(separator)) {
-      localMappingName = localMappingName.substring(0, 
localMappingName.length() - 1);
-    }
-    // strip _ at the beginning
-    while (localMappingName.startsWith(separator)) {
-      localMappingName = localMappingName.substring(1);
-    }
-
-    // "CamelCasing"
-    int pos = localMappingName.indexOf(separator);
-    while (pos != -1) {
-      final String leftPart = localMappingName.substring(0, pos);
-      final String camelLetter = String.valueOf(localMappingName.charAt(pos + 
1)).toUpperCase();
-      final String rightPart = localMappingName.substring(pos + 2);
-      localMappingName = leftPart + camelLetter + rightPart;
-      pos = localMappingName.indexOf(separator);
-    }
-    return localMappingName;
-  }
-
-  private static String lowerCaseFirst(String value) {
-    if (value.length() > 1) {
-      return value.substring(0, 1).toLowerCase() + value.substring(1);
-    }
-    return value;
-  }
-
 }

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to