[pi-code-cleaning] Some Dead Code removed from the code
authorNaroa Iriarte <naroa.iriarte@openbravo.com>
Thu, 28 Apr 2016 10:33:34 +0200
changeset 29523 d14b1ea13eb2
parent 29522 712fa343d0d6
child 29524 ca070e9acdd1
[pi-code-cleaning] Some Dead Code removed from the code

There was some dead code that has been removed.
modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java
src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts.java
src/org/openbravo/erpCommon/ad_forms/ProductInfo.java
src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java
src/org/openbravo/service/system/DatabaseValidator.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Wed Apr 27 17:10:09 2016 +0200
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/DefaultDataSourceService.java	Thu Apr 28 10:33:34 2016 +0200
@@ -357,12 +357,7 @@
     if (entity == null) {
       dsProperties = super.getDataSourceProperties(parameters);
     } else {
-      if (false) {
-        dsProperties = getInitialProperties(entity,
-            parameters.containsKey(DataSourceConstants.MINIMAL_PROPERTY_OUTPUT));
-      } else {
-        dsProperties = getInitialProperties(entity, false);
-      }
+      dsProperties = getInitialProperties(entity, false);
     }
 
     // now see if there are additional properties, these are often property paths
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts.java	Wed Apr 27 17:10:09 2016 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Payment_Amounts.java	Thu Apr 28 10:33:34 2016 +0200
@@ -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) 2001-2010 Openbravo SLU 
+ * All portions are Copyright (C) 2001-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -85,25 +85,15 @@
     BigDecimal payamt, discountamt, writeoffamt, overunderamt, convert, invtotamt;
 
     payamt = new BigDecimal(strPayamt);
-    if (payamt == null)
-      payamt = ZERO;
     discountamt = new BigDecimal(strDiscountamt);
-    if (discountamt == null)
-      discountamt = ZERO;
     writeoffamt = new BigDecimal(strWriteoffamt);
-    if (writeoffamt == null)
-      writeoffamt = ZERO;
     overunderamt = new BigDecimal(strOverunderamt);
-    if (overunderamt == null)
-      overunderamt = ZERO;
 
     StringBuffer resultado = new StringBuffer();
     resultado.append("var calloutName='SL_Payment_Amounts';\n\n");
     resultado.append("var respuesta = new Array(");
     if (strChanged.equals("inpisoverunderpayment")) {
       overunderamt = new BigDecimal(strOverunderamt);
-      if (overunderamt == null)
-        overunderamt = ZERO;
       resultado.append("new Array(\"inpoverunderamt\", " + overunderamt.toString() + ")");
     }
 
@@ -174,8 +164,6 @@
       if (log4j.isDebugEnabled())
         log4j.debug("PAYMENT: " + data[0].grand + "CURRENCYID: " + data[0].currencyid);
       invtotamt = new BigDecimal(data[0].grand);
-      if (invtotamt == null)
-        invtotamt = ZERO;
       if (strcCurrencyId.equals(data[0].currencyid)) {
       } else {
         String strconvert = SLPaymentAmountsData.selectConversion(this, data[0].currencyid,
@@ -188,8 +176,6 @@
     } else if (strChanged.equals("inpdiscountamt")) {
       SLPaymentAmountsData[] data = SLPaymentAmountsData.select(this, strcInvoiceId);
       invtotamt = new BigDecimal(data[0].grand);
-      if (invtotamt == null)
-        invtotamt = ZERO;
       if (strcCurrencyId.equals(data[0].currencyid)) {
       } else {
         String strconvert = SLPaymentAmountsData.selectConversion(this, data[0].currencyid,
@@ -202,8 +188,6 @@
     } else if (strChanged.equals("inpwriteoffamt")) {
       SLPaymentAmountsData[] data = SLPaymentAmountsData.select(this, strcInvoiceId);
       invtotamt = new BigDecimal(data[0].grand);
-      if (invtotamt == null)
-        invtotamt = ZERO;
       if (strcCurrencyId.equals(data[0].currencyid)) {
       } else {
         String strconvert = SLPaymentAmountsData.selectConversion(this, data[0].currencyid,
@@ -216,8 +200,6 @@
     } else if (strChanged.equals("inpoverunderamt")) {
       SLPaymentAmountsData[] data = SLPaymentAmountsData.select(this, strcInvoiceId);
       invtotamt = new BigDecimal(data[0].grand);
-      if (invtotamt == null)
-        invtotamt = ZERO;
       invtotamt = invtotamt.subtract(overunderamt).subtract(writeoffamt).subtract(discountamt);
       resultado.append("new Array(\"inppayamt\", " + invtotamt.toString() + ")");
     }
--- a/src/org/openbravo/erpCommon/ad_forms/ProductInfo.java	Wed Apr 27 17:10:09 2016 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/ProductInfo.java	Thu Apr 28 10:33:34 2016 +0200
@@ -11,7 +11,7 @@
  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
  * created by ComPiere are Copyright (C) ComPiere, Inc.;   All Rights Reserved.
  * Contributor(s): Openbravo SLU
- * Contributions are Copyright (C) 2001-2012 Openbravo S.L.U.
+ * Contributions are Copyright (C) 2001-2016 Openbravo S.L.U.
  ******************************************************************************
  */
 package org.openbravo.erpCommon.ad_forms;
@@ -278,10 +278,6 @@
       return null;
     }
     BigDecimal cost = new BigDecimal(getProductItemCost(date, as, "", conn, con));
-    if (cost == null) {
-      log4jProductInfo.debug("getProductCosts - No Costs");
-      return null;
-    }
     log4jProductInfo.debug("getProductCosts - qty = " + m_qty);
     if (strQty == null || strQty.equals("")) {
       BigDecimal qty = new BigDecimal(m_qty);
--- a/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Wed Apr 27 17:10:09 2016 +0200
+++ b/src/org/openbravo/erpCommon/utility/reporting/printing/PrintController.java	Thu Apr 28 10:33:34 2016 +0200
@@ -8,7 +8,7 @@
  * 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) 2008-2015 Openbravo SLU All Rights Reserved.
+ * portions are Copyright (C) 2008-2016 Openbravo SLU All Rights Reserved.
  * Contributor(s): ______________________________________.
  */
 package org.openbravo.erpCommon.utility.reporting.printing;
@@ -1334,28 +1334,20 @@
     // check the templates
     if (differentDocTypes.size() > 1) { // the templates selector shouldn't
       // appear
-      if (discard == null) { // Its the only think to hide
-        discard = new String[] { "discardSelect" };
-      } else {
-        final String[] discardAux = new String[discard.length + 1];
-        for (int i = 0; i < discard.length; i++) {
-          discardAux[i] = discard[i];
-        }
-        discardAux[discard.length] = "discardSelect";
-        return discardAux;
+      final String[] discardAux = new String[discard.length + 1];
+      for (int i = 0; i < discard.length; i++) {
+        discardAux[i] = discard[i];
       }
+      discardAux[discard.length] = "discardSelect";
+      return discardAux;
     }
     if (vector == null && vars.getMultiFile("inpFile") == null) {
-      if (discard == null) {
-        discard = new String[] { "view" };
-      } else {
-        final String[] discardAux = new String[discard.length + 1];
-        for (int i = 0; i < discard.length; i++) {
-          discardAux[i] = discard[i];
-        }
-        discardAux[discard.length] = "view";
-        return discardAux;
+      final String[] discardAux = new String[discard.length + 1];
+      for (int i = 0; i < discard.length; i++) {
+        discardAux[i] = discard[i];
       }
+      discardAux[discard.length] = "view";
+      return discardAux;
     }
     return discard;
   }
--- a/src/org/openbravo/service/system/DatabaseValidator.java	Wed Apr 27 17:10:09 2016 +0200
+++ b/src/org/openbravo/service/system/DatabaseValidator.java	Thu Apr 28 10:33:34 2016 +0200
@@ -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) 2009-2014 Openbravo SLU 
+ * All portions are Copyright (C) 2009-2016 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -490,7 +490,6 @@
 
         dbColumnsByName.remove(column.getDBColumnName().toUpperCase());
 
-        checkDefaultValue(column, dbColumn, result);
       }
     }
 
@@ -505,35 +504,6 @@
     }
   }
 
-  private void checkDefaultValue(Column adColumn, org.apache.ddlutils.model.Column dbColumn,
-      SystemValidationResult result) {
-    if (true) {
-      // disable this test until the following issues are all solved:
-      // https://issues.openbravo.com/view.php?id=9054
-      // https://issues.openbravo.com/view.php?id=9053
-      // https://issues.openbravo.com/view.php?id=9052
-      // https://issues.openbravo.com/view.php?id=9051
-      // https://issues.openbravo.com/view.php?id=9050
-      // these cover the differences in default values
-      return;
-    }
-    if (adColumn.getDefaultValue() == null || adColumn.getDefaultValue().startsWith("@")) {
-      return;
-    } else if (false && dbColumn.getDefaultValue() == null) {
-      // this check is disabled for now
-      result.addWarning(SystemValidationType.UNEQUAL_DEFAULTVALUE, "Column "
-          + adColumn.getTable().getName() + "." + adColumn.getName() + " has default value "
-          + adColumn.getDefaultValue()
-          + " in the Application Dictionary but no default value in the database");
-    } else if (dbColumn.getDefaultValue() != null
-        && !dbColumn.getDefaultValue().equals(adColumn.getDefaultValue())) {
-      result.addWarning(SystemValidationType.UNEQUAL_DEFAULTVALUE, "Column "
-          + adColumn.getTable().getName() + "." + adColumn.getName()
-          + ": the Application Dictionary and the database have differing default values,"
-          + " AD: " + adColumn.getDefaultValue() + " DB: " + dbColumn.getDefaultValue());
-    }
-  }
-
   private void checkDataType(Column adColumn, org.apache.ddlutils.model.Column dbColumn,
       SystemValidationResult result, org.apache.ddlutils.model.Table dbTable) {