[Product Services] Merged Services branch
authorAaron Calero <aaron.calero@openbravo.com>
Mon, 23 Nov 2015 10:08:15 +0100
changeset 28645 34256f6c8e07
parent 28644 66ab9a02326a (current diff)
parent 28286 4b1da36d4b2c (diff)
child 28646 7d8b06f475a6
[Product Services] Merged Services branch
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.apachejdbcconnectionpool/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.base.weld/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.application/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/main/ob-standard-view.js
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.htmlwidget/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.kernel/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.myob/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.querylist/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.client.widgets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.financial.paymentreport/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.reports.ordersawaitingdelivery/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.integration.google/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.integration.openid/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.service.json/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.skin.250to300Comp/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.userinterface.smartclient/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.utility.cleanup.log/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3.datasets/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3.framework/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE.xml
modules/org.openbravo.v3/src-db/database/sourcedata/AD_MODULE_DEPENDENCY.xml
src-db/database/sourcedata/AD_AUXILIARINPUT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_MODULE.xml
src/org/openbravo/service/importprocess/ImportEntryManager.java
src/org/openbravo/service/importprocess/ImportEntryProcessor.java
src/org/openbravo/service/importprocess/ImportProcessUtils.java
--- a/.hgsigs	Fri Nov 20 10:01:29 2015 +0100
+++ b/.hgsigs	Mon Nov 23 10:08:15 2015 +0100
@@ -176,5 +176,9 @@
 906c7a47100c5694d720f6a00a8d205538562334 0 iEYEABECAAYFAlW3GiEACgkQCX/oGf+2qkNk4gCfVlZA1GqR2LvJwBPBXoMn6RCRyFYAnA4aPF+fOZXRpAqKMRT55nvswuRI
 6dfd2fade034c7225367366dc34dcf402b596555 0 iEYEABECAAYFAlXccLwACgkQCX/oGf+2qkPEMQCeM4MxdgXlCtbu0xqZNcX0IAEuGZgAnAjQlB4gOw0q84Q/gFyRL38jkahJ
 9f4a209cc84b3b4e7f3176388f6d6071779ac3e2 0 iEYEABECAAYFAlX5YqQACgkQCX/oGf+2qkOLNwCgr9InQrxWVMHG2e7sabvZBm3KD6gAoPvoMDHktqqkv2Qqtbv3G1mqpTrM
+f22b32ad49b1baca7b310bdf68d8d411e897f7bf 0 iEYEABECAAYFAlYtwHYACgkQCX/oGf+2qkOQ1QCgsBVLaaNfILpxAYrZfhBD+GDVVLEAnREcCa1Lvzf4mJ8eD8VWTx1g8kqk
 73f7d3c67dc7d6063af1dac6e71db12b9081150a 0 iEYEABECAAYFAlXMHl0ACgkQCX/oGf+2qkNVuACfTfB6/RfeioYrYtsi81kAwADW0lgAoOJdXKScLwl6RHeXIFvMlrzlcT6w
 f8b98762376a89ec93a0a623c61fdab00975c3a9 0 iEYEABECAAYFAlXtQ4gACgkQCX/oGf+2qkMZUgCePOnen6iguLqaG+86NeCC8Hr0yzAAoKTnw/BIXyBm5Ski5JQT/0mF1zHK
+9755d00af209f39887eba34a08922463fbcdac91 0 iEYEABECAAYFAlYt2zgACgkQCX/oGf+2qkN1KgCg6tzAQat0ZJJIWeFyr6yLRVCvh24AnjVyPbFPvbJ3/EOgUHtJWz5lWzeM
+d20a396ffa245fd3cdbadc3196df3554018d2e20 0 iEYEABECAAYFAlY4SL4ACgkQCX/oGf+2qkOjJACfS1q37UfrWobml4IVCOKqGeV+CU0An3iRcDJJ+N3aJMuzjkZh8xYe0mRQ
+d2c765a228d83098cc5f253cdd364abdb4a4697e 0 iEYEABECAAYFAlZOorMACgkQCX/oGf+2qkMFfwCgocaX6vsWuoGtE55aoHgBD1/7OKoAoOv4J31+P+8BtkVHJyKLhxGVBoLo
--- a/.hgtags	Fri Nov 20 10:01:29 2015 +0100
+++ b/.hgtags	Mon Nov 23 10:08:15 2015 +0100
@@ -187,5 +187,9 @@
 01405101d810eaafec106bab50ce31b41df52569 3.0PR15Q2.3
 d26c43a861dec9147a6a60d8aca52359837e9591 3.0PR15Q2.4
 f38025d616fa8a50a95d0dd3a3c38bcf6bbce053 3.0PR15Q2.5
+8b094ef73876cad67e35345c1add17266413af46 3.0PR15Q2.6
 828faf1939944cd8d55d562494138f68305c5b50 3.0PR15Q3
 e5863950c81de2bcf7dce57035094e96d544a9ae 3.0PR15Q3.1
+9320a67a9ef1cafb5076d06bdd6d716abc662c40 3.0PR15Q3.2
+bce57079bd436cec545edb6c12246170862f0416 3.0PR15Q3.3
+84cd25c33900a44c955c5a899e570281f02e0ccc 3.0PR15Q4
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Mon Nov 23 10:08:15 2015 +0100
@@ -20,7 +20,6 @@
 package org.openbravo.advpaymentmngt.utility;
 
 import java.math.BigDecimal;
-import java.sql.BatchUpdateException;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.ParseException;
@@ -80,6 +79,7 @@
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
 import org.openbravo.model.financialmgmt.payment.FinAccPaymentMethod;
 import org.openbravo.service.db.CallStoredProcedure;
+import org.openbravo.service.db.DbUtility;
 import org.openbravo.utils.Replace;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -260,12 +260,8 @@
    * @return the underlying trigger message.
    */
   public static String getExceptionMessage(Throwable t) {
-    if (t.getCause() instanceof BatchUpdateException
-        && ((BatchUpdateException) t.getCause()).getNextException() != null) {
-      final BatchUpdateException bue = (BatchUpdateException) t.getCause();
-      return bue.getNextException().getMessage();
-    }
-    return t.getMessage();
+    Throwable throwable = DbUtility.getUnderlyingSQLException(t);
+    return throwable.getMessage();
   }
 
   /**
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java	Mon Nov 23 10:08:15 2015 +0100
@@ -18,7 +18,6 @@
  */
 package org.openbravo.service.json;
 
-import java.sql.BatchUpdateException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -48,6 +47,7 @@
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.SessionInfo;
 import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.service.db.DbUtility;
 import org.openbravo.service.json.JsonToDataConverter.JsonConversionError;
 import org.openbravo.userinterface.selector.SelectorConstants;
 
@@ -824,12 +824,7 @@
         return result;
       }
     } catch (Throwable t) {
-      Throwable localThrowable = t;
-      if (localThrowable.getCause() instanceof BatchUpdateException) {
-        final BatchUpdateException batchException = (BatchUpdateException) localThrowable
-            .getCause();
-        localThrowable = batchException.getNextException();
-      }
+      Throwable localThrowable = DbUtility.getUnderlyingSQLException(t);
       if (!(localThrowable instanceof OBException)
           || (localThrowable instanceof OBException && ((OBException) localThrowable)
               .isLogExceptionNeeded())) {
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java	Mon Nov 23 10:08:15 2015 +0100
@@ -18,7 +18,6 @@
  */
 package org.openbravo.service.json;
 
-import java.sql.BatchUpdateException;
 import java.sql.SQLTimeoutException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -44,6 +43,7 @@
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.Utility;
 import org.openbravo.service.db.DalConnectionProvider;
+import org.openbravo.service.db.DbUtility;
 import org.postgresql.util.PSQLException;
 
 /**
@@ -200,11 +200,7 @@
    * @return the resulting json string
    */
   public static String convertExceptionToJson(Throwable throwable) {
-    Throwable localThrowable = throwable;
-    if (throwable.getCause() instanceof BatchUpdateException) {
-      final BatchUpdateException batchException = (BatchUpdateException) throwable.getCause();
-      localThrowable = batchException.getNextException();
-    }
+    Throwable localThrowable = DbUtility.getUnderlyingSQLException(throwable);
 
     try {
       final JSONObject jsonResult = new JSONObject();
--- a/src-core/src/org/openbravo/base/filter/NumberFilter.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src-core/src/org/openbravo/base/filter/NumberFilter.java	Mon Nov 23 10:08:15 2015 +0100
@@ -1,6 +1,6 @@
 /*
  ************************************************************************************
- * Copyright (C) 2009-2010 Openbravo S.L.U.
+ * Copyright (C) 2009-2015 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  distributed
@@ -23,7 +23,6 @@
 
   public static final NumberFilter instance = new NumberFilter();
 
-  @SuppressWarnings("unused")
   @Override
   public boolean accept(String value) {
     try {
--- a/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Fri Nov 20 10:01:29 2015 +0100
+++ b/src-db/database/model/functions/M_EXPLODEBOMNOTSTOCK.xml	Mon Nov 23 10:08:15 2015 +0100
@@ -201,8 +201,8 @@
          END IF;
 
       END LOOP; -- Create New Lines
+      UPDATE c_orderline set explode='Y' where c_orderline_id = v_Record_ID;
     END LOOP; -- Replace Lines
-    UPDATE c_orderline set explode='Y' where c_orderline_id = v_Record_ID;
 
     IF (v_orderline_ID IS NOT NULL) THEN
       M_EXPLODEBOMNOTSTOCK(null, v_orderline_ID); 
--- a/src/org/openbravo/base/exception/OBException.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/base/exception/OBException.java	Mon Nov 23 10:08:15 2015 +0100
@@ -19,9 +19,8 @@
 
 package org.openbravo.base.exception;
 
-import java.sql.BatchUpdateException;
-
 import org.apache.log4j.Logger;
+import org.openbravo.service.db.DbUtility;
 
 /**
  * This is the base exception for all exceptions in Openbravo. It is an unchecked exception which
@@ -66,7 +65,7 @@
 
   public OBException(Throwable cause) {
     super(cause);
-    Throwable foundCause = getCausingException(cause);
+    Throwable foundCause = DbUtility.getUnderlyingSQLException(cause);
     if (foundCause != cause) {
       // passing foundCause ensures that the underlying stack trace is printed
       getLogger().error(cause.getMessage() + " - " + foundCause.getMessage(), foundCause);
@@ -93,23 +92,4 @@
   public boolean isLogExceptionNeeded() {
     return logExceptionNeeded;
   }
-
-  /**
-   * Hibernate and JDBC will wrap the exception thrown by triggers/constraints in another exception
-   * (the java.sql.BatchUpdateException) and this exception is sometimes wrapped again. Also the
-   * java.sql.BatchUpdateException stores the underlying exception in the nextException and not in
-   * the cause property. This method retrieves the original cause of the exception in this type of
-   * cases.
-   * 
-   * @return a Throwable object with the causing exception
-   */
-  public static Throwable getCausingException(Throwable t) {
-    if (t instanceof BatchUpdateException) {
-      return ((BatchUpdateException) t).getNextException();
-    } else if (t.getCause() instanceof BatchUpdateException
-        && ((BatchUpdateException) t.getCause()).getNextException() != null) {
-      return ((BatchUpdateException) t.getCause()).getNextException();
-    }
-    return t;
-  }
 }
--- a/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/common/actionhandler/RMInOutPickEditLines.java	Mon Nov 23 10:08:15 2015 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2011-2012 Openbravo SLU 
+ * All portions are Copyright (C) 2011-2015 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -97,6 +97,8 @@
       removeNonSelectedLines(idList, inOut);
       return;
     }
+
+    ShipmentInOutLine parentInOutLine = null;
     for (long i = 0; i < selectedLines.length(); i++) {
       JSONObject selectedLine = selectedLines.getJSONObject((int) i);
       log.debug(selectedLine);
@@ -137,11 +139,20 @@
         inOutLines.add(newInOutLine);
         inOut.setMaterialMgmtShipmentInOutLineList(inOutLines);
       }
-
+      if (orderLine.isExplode()) {
+        newInOutLine.setExplode(true);
+        parentInOutLine = newInOutLine;
+      }
       OBDal.getInstance().save(newInOutLine);
       OBDal.getInstance().save(inOut);
       OBDal.getInstance().flush();
     }
+    for (ShipmentInOutLine inOutLine : inOut.getMaterialMgmtShipmentInOutLineList()) {
+      if (inOutLine.getSalesOrderLine().getBOMParent() != null) {
+        inOutLine.setBOMParent(parentInOutLine);
+        OBDal.getInstance().save(inOutLine);
+      }
+    }
 
     removeNonSelectedLines(idList, inOut);
   }
--- a/src/org/openbravo/dal/core/SessionHandler.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/dal/core/SessionHandler.java	Mon Nov 23 10:08:15 2015 +0100
@@ -29,7 +29,6 @@
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
-import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.provider.OBNotSingleton;
 import org.openbravo.base.provider.OBProvider;
@@ -40,6 +39,7 @@
 import org.openbravo.base.util.Check;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.ExternalConnectionPool;
+import org.openbravo.service.db.DbUtility;
 
 /**
  * Keeps the Hibernate Session and Transaction in a ThreadLocal so that it is available throughout
@@ -273,7 +273,7 @@
       tx = null;
       err = false;
     } catch (SQLException e) {
-      log.error("Error while closing the connection", OBException.getCausingException(e));
+      log.error("Error while closing the connection", DbUtility.getUnderlyingSQLException(e));
     } finally {
       if (err) {
         try {
--- a/src/org/openbravo/service/db/DataImportService.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/service/db/DataImportService.java	Mon Nov 23 10:08:15 2015 +0100
@@ -456,14 +456,12 @@
       boolean isBatchUpdateException = false;
       // We need to capture nested exception of BatchUpdate exception.
       Throwable cause = t.getCause();
-      if (cause instanceof BatchUpdateException) {
-        BatchUpdateException batchUpdateException = (BatchUpdateException) cause;
-        if (batchUpdateException.getNextException() != null) {
-          String errorMessage = batchUpdateException.getNextException().getMessage();
-          String messageKey = errorMessage.substring("ERROR:".length()).trim();
-          isBatchUpdateException = true;
-          ir.setErrorMessages("isBatchUpdateException:" + messageKey);
-        }
+      Throwable foundCause = DbUtility.getUnderlyingSQLException(t);
+      if (cause instanceof BatchUpdateException && t != foundCause) {
+        String errorMessage = foundCause.getMessage();
+        String messageKey = errorMessage.substring("ERROR:".length()).trim();
+        isBatchUpdateException = true;
+        ir.setErrorMessages("isBatchUpdateException:" + messageKey);
       }
       OBDal.getInstance().rollbackAndClose();
       rolledBack = true;
--- a/src/org/openbravo/service/db/DbUtility.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/service/db/DbUtility.java	Mon Nov 23 10:08:15 2015 +0100
@@ -49,6 +49,10 @@
    */
   public static Throwable getUnderlyingSQLException(Throwable throwable) {
 
+    if (throwable instanceof BatchUpdateException
+        && ((BatchUpdateException) throwable).getNextException() != null) {
+      return ((BatchUpdateException) throwable).getNextException();
+    }
     if (throwable.getCause() instanceof BatchUpdateException
         && ((BatchUpdateException) throwable.getCause()).getNextException() != null) {
       final BatchUpdateException bue = (BatchUpdateException) throwable.getCause();
--- a/src/org/openbravo/service/importprocess/ImportProcessUtils.java	Fri Nov 20 10:01:29 2015 +0100
+++ b/src/org/openbravo/service/importprocess/ImportProcessUtils.java	Mon Nov 23 10:08:15 2015 +0100
@@ -20,7 +20,6 @@
 
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.sql.BatchUpdateException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -34,6 +33,7 @@
 import org.openbravo.base.session.OBPropertiesProvider;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.domain.Reference;
+import org.openbravo.service.db.DbUtility;
 
 /**
  * Utility methods used in the import process.
@@ -105,10 +105,7 @@
   }
 
   public static void logError(Logger log, Throwable t) {
-    Throwable toReport = t;
-    if (t.getCause() instanceof BatchUpdateException) {
-      toReport = ((BatchUpdateException) t.getCause()).getNextException();
-    }
+    Throwable toReport = DbUtility.getUnderlyingSQLException(t);
     log.error(toReport.getMessage(), toReport);
   }
 
@@ -118,13 +115,10 @@
     PrintWriter pw = new PrintWriter(sb);
 
     e.printStackTrace(pw);
-
-    if (e.getCause() instanceof BatchUpdateException) {
-      final BatchUpdateException batchException = (BatchUpdateException) e.getCause();
-      if (batchException.getNextException() != null) {
-        pw.write("\n >>>> Next Exception:\n");
-        batchException.getNextException().printStackTrace(pw);
-      }
+    Throwable foundCause = DbUtility.getUnderlyingSQLException(e);
+    if (e != foundCause) {
+      pw.write("\n >>>> Next Exception:\n");
+      foundCause.printStackTrace(pw);
     }
 
     return sb.toString();