From b2f5a7a0ae84465756359d39db2427b35e1864da Mon Sep 17 00:00:00 2001 From: Diego Ruiz <12065321+d-ruiz@users.noreply.github.com> Date: Mon, 11 Jul 2022 08:07:25 +0200 Subject: [PATCH] IDEMPIERE-4723 - Remove dead code from Callout classes (#1388) --- .../compiere/model/CalloutBankStatement.java | 2 - .../compiere/model/CalloutImportTemplate.java | 9 --- .../src/org/compiere/model/CalloutInOut.java | 1 - .../org/compiere/model/CalloutInvoice.java | 33 ---------- .../src/org/compiere/model/CalloutOrder.java | 10 --- .../org/compiere/model/CalloutPackage.java | 62 ------------------- .../org/compiere/model/CalloutPayment.java | 7 --- .../model/CalloutPaymentAllocate.java | 3 - .../model/CalloutProcessCustomization.java | 4 -- 9 files changed, 131 deletions(-) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutBankStatement.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutBankStatement.java index 70693dee69..a06c1f77c4 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutBankStatement.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutBankStatement.java @@ -88,7 +88,6 @@ public class CalloutBankStatement extends CalloutEngine if (charge == null) charge = Env.ZERO; bd = bd.subtract(charge); - // log.trace(log.l5_DData, "Interest (" + bd + ") = Stmt(" + stmt + ") - Trx(" + trx + ") - Charge(" + charge + ")"); mTab.setValue("InterestAmt", bd); } // Calculate Charge @@ -98,7 +97,6 @@ public class CalloutBankStatement extends CalloutEngine if (interest == null) interest = Env.ZERO; bd = bd.subtract(interest); - // log.trace(log.l5_DData, "Charge (" + bd + ") = Stmt(" + stmt + ") - Trx(" + trx + ") - Interest(" + interest + ")"); mTab.setValue("ChargeAmt", bd); } return ""; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutImportTemplate.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutImportTemplate.java index 967114cf90..6b6d209f2b 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutImportTemplate.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutImportTemplate.java @@ -45,15 +45,6 @@ public class CalloutImportTemplate extends CalloutEngine String characterSet = value.toString(); if (!Charset.isSupported(characterSet)) { - /* - StringBuilder valid = new StringBuilder(); - for (Charset validch : Charset.availableCharsets().values()) { - if (valid.length() > 0) - valid.append(", "); - valid.append(validch.displayName()); - } - return Msg.parseTranslation(ctx, "@Invalid@ @CharacterSet@ -> " + valid); - */ return Msg.parseTranslation(ctx, "@Invalid@ @CharacterSet@"); } diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java index 237706a5e7..3624546ba9 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInOut.java @@ -569,7 +569,6 @@ public class CalloutInOut extends CalloutEngine return ""; int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); - // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); BigDecimal MovementQty, QtyEntered; // No Product diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java index 8d10cc3c67..e468d45568 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutInvoice.java @@ -365,7 +365,6 @@ public class CalloutInvoice extends CalloutEngine mTab.setValue("PriceActual", pp.getPriceStd()); mTab.setValue("PriceEntered", pp.getPriceStd()); mTab.setValue("C_Currency_ID", Integer.valueOf(pp.getC_Currency_ID())); - // mTab.setValue("Discount", pp.getDiscount()); mTab.setValue("C_UOM_ID", Integer.valueOf(pp.getC_UOM_ID())); Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N"); Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N"); @@ -541,7 +540,6 @@ public class CalloutInvoice extends CalloutEngine if (isCalloutActive() || value == null) return ""; - // log.log(Level.WARNING,"amt - init"); int C_UOM_To_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "C_UOM_ID"); int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); int M_PriceList_ID = Env.getContextAsInt(ctx, WindowNo, "M_PriceList_ID"); @@ -556,7 +554,6 @@ public class CalloutInvoice extends CalloutEngine // PriceEntered = (BigDecimal)mTab.getValue("PriceEntered"); PriceActual = (BigDecimal)mTab.getValue("PriceActual"); - // Discount = (BigDecimal)mTab.getValue("Discount"); PriceLimit = (BigDecimal)mTab.getValue("PriceLimit"); PriceList = (BigDecimal)mTab.getValue("PriceList"); if (log.isLoggable(Level.FINE)){ @@ -613,7 +610,6 @@ public class CalloutInvoice extends CalloutEngine + ", PriceEntered=" + PriceEntered + ", Discount=" + pp.getDiscount()); PriceActual = pp.getPriceStd(); mTab.setValue("PriceActual", pp.getPriceStd()); - // mTab.setValue("Discount", pp.getDiscount()); mTab.setValue("PriceEntered", PriceEntered); Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N"); } @@ -642,33 +638,6 @@ public class CalloutInvoice extends CalloutEngine mTab.setValue("PriceActual", PriceActual); } - /** Discount entered - Calculate Actual/Entered - if (mField.getColumnName().equals("Discount")) - { - PriceActual = new BigDecimal ((100.0 - Discount.doubleValue()) / 100.0 * PriceList.doubleValue()); - if (PriceActual.scale() > StdPrecision) - PriceActual = PriceActual.setScale(StdPrecision, RoundingMode.HALF_UP); - PriceEntered = MUOMConversion.convertProductFrom (ctx, M_Product_ID, - C_UOM_To_ID, PriceActual); - if (PriceEntered == null) - PriceEntered = PriceActual; - mTab.setValue("PriceActual", PriceActual); - mTab.setValue("PriceEntered", PriceEntered); - } - // calculate Discount - else - { - if (PriceList.compareTo(Env.ZERO) == 0) - Discount = Env.ZERO; - else - Discount = new BigDecimal ((PriceList.doubleValue() - PriceActual.doubleValue()) / PriceList.doubleValue() * 100.0); - if (Discount.scale() > 2) - Discount = Discount.setScale(2, RoundingMode.HALF_UP); - mTab.setValue("Discount", Discount); - } - log.fine("amt = PriceEntered=" + PriceEntered + ", Actual" + PriceActual + ", Discount=" + Discount); - /* */ - // Check PriceLimit String epl = Env.getContext(ctx, WindowNo, "EnforcePriceLimit"); boolean enforce = Env.isSOTrx(ctx, WindowNo) && epl != null && !epl.equals("") ? epl.equals("Y") : isEnforcePriceLimit; @@ -693,7 +662,6 @@ public class CalloutInvoice extends CalloutEngine Discount = BigDecimal.valueOf((PriceList.doubleValue () - PriceActual.doubleValue ()) / PriceList.doubleValue () * 100.0); if (Discount.scale () > 2) Discount = Discount.setScale (2, RoundingMode.HALF_UP); - // mTab.setValue ("Discount", Discount); } } @@ -772,7 +740,6 @@ public class CalloutInvoice extends CalloutEngine return ""; int M_Product_ID = Env.getContextAsInt(ctx, WindowNo, mTab.getTabNo(), "M_Product_ID"); - // log.log(Level.WARNING,"qty - init - M_Product_ID=" + M_Product_ID); BigDecimal QtyInvoiced, QtyEntered, PriceActual, PriceEntered; // No Product diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java index 1854523f3f..3c47048cc3 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutOrder.java @@ -802,16 +802,6 @@ public class CalloutOrder extends CalloutEngine Env.setContext(ctx, WindowNo, "EnforcePriceLimit", pp.isEnforcePriceLimit() ? "Y" : "N"); Env.setContext(ctx, WindowNo, "DiscountSchema", pp.isDiscountSchema() ? "Y" : "N"); - // Check/Update Warehouse Setting - // int M_Warehouse_ID = Env.getContextAsInt(ctx, WindowNo, "M_Warehouse_ID"); - // Integer wh = (Integer)mTab.getValue("M_Warehouse_ID"); - // if (wh.intValue() != M_Warehouse_ID) - // { - // mTab.setValue("M_Warehouse_ID", Integer.valueOf(M_Warehouse_ID)); - // ADialog.warn(,WindowNo, "WarehouseChanged"); - // } - - if (Env.isSOTrx(ctx, WindowNo)) { MProduct product = MProduct.get (ctx, M_Product_ID.intValue()); diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPackage.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPackage.java index 72ee1df303..4e9d9d29f0 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPackage.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPackage.java @@ -66,68 +66,6 @@ public class CalloutPackage extends CalloutEngine { int shipper_id = ((Integer)value).intValue(); -/* if(value != oldValue) - { - if (Ini.isClient()) - { - try - { - Class cl = Class.forName("org.compiere.apps.ADialog"); - Class paramTypes[] = {int.class, Container.class, String.class, String.class}; - Object params[] = {windowNo, Env.getWindow(windowNo), "Update Shipment Method", "Are you sure you want to apply this Shipment Method to the Shipment?"}; - Method method = cl.getDeclaredMethod("ask", paramTypes); - Boolean ok = (Boolean) method.invoke(null, params); - - if(!ok) - { - // don't update the shipper of shipment record but continue with default values setting - //return ""; - } - else - { - int inout_id = Env.getContextAsInt(ctx, windowNo, "M_InOut_ID"); - String sql = "update M_InOut set M_Shipper_ID=? where M_InOut_ID=?"; - DB.executeUpdate(sql, new Object[] { shipper_id, inout_id }, false, null); - } - } - catch (Exception ex) - { - throw new AdempiereException(ex); - } - } - else - { - try - { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) - loader = this.getClass().getClassLoader(); - Class clazz = loader.loadClass("org.adempiere.webui.window.FDialog"); - Class clazz1 = loader.loadClass("org.zkoss.zk.ui.Component"); - - Method m = clazz.getMethod("ask", Integer.TYPE, clazz1, String.class, String.class); - Boolean returnCode = (Boolean)m.invoke(null, 0, null, "Update Shipment Method", - "Are you sure you want to apply this Shipment Method to the Shipment?"); - - if(!returnCode) - { - // don't update the shipper of shipment record but continue with default values setting - //return ""; - } - else - { - int inout_id = Env.getContextAsInt(ctx, windowNo, "M_InOut_ID"); - String sql = "update M_InOut set M_Shipper_ID=? where M_InOut_ID=?"; - DB.executeUpdate(sql, new Object[] { shipper_id, inout_id }, false, null); - } - } - catch (Exception e) - { - throw new AdempiereException(e); - } - } - } -*/ String whereClause = "M_Shipper_ID = " + shipper_id + " AND IsDefault='Y' AND IsActive='Y'"; int[] ids = MShipperLabels.getAllIDs(MShipperLabels.Table_Name, whereClause, null); if (ids.length > 0) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java index 3e90f942e4..d8cb9cac75 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPayment.java @@ -67,7 +67,6 @@ public class CalloutPayment extends CalloutEngine // mTab.setValue ("DiscountAmt", Env.ZERO); mTab.setValue ("WriteOffAmt", Env.ZERO); - // mTab.setValue ("IsOverUnderPayment", Boolean.FALSE); mTab.setValue ("OverUnderAmt", Env.ZERO); int C_InvoicePaySchedule_ID = 0; if (Env.getContextAsInt (ctx, WindowNo, Env.TAB_INFO, "C_Invoice_ID") == C_Invoice_ID.intValue () @@ -218,8 +217,6 @@ public class CalloutPayment extends CalloutEngine return ""; mTab.setValue ("C_Invoice_ID", null); mTab.setValue ("C_Order_ID", null); - // 2008/07/18 Globalqss [ 2021745 ] - // mTab.setValue ("C_Project_ID", null); mTab.setValue ("IsPrepayment", Boolean.FALSE); // mTab.setValue ("DiscountAmt", Env.ZERO); @@ -267,8 +264,6 @@ public class CalloutPayment extends CalloutEngine } // globalqss - Allow prepayment to Purchase Orders // Order Waiting Payment (can only be SO) - // if (C_Order_ID != 0 && dt != null && !dt.isSOTrx()) - // return "PaymentDocTypeInvoiceInconsistent"; // Order if (C_Order_ID != 0) { @@ -476,8 +471,6 @@ public class CalloutPayment extends CalloutEngine AD_Org_ID); if (CurrencyRate == null || CurrencyRate.compareTo (Env.ZERO) == 0) { - // mTab.setValue("C_Currency_ID", new - // Integer(C_Currency_Invoice_ID)); // does not work if (C_Currency_Invoice_ID == 0) return ""; // no error message when no invoice is selected return "NoCurrencyConversion"; diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java index aa014c8078..b791faeac9 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutPaymentAllocate.java @@ -95,9 +95,6 @@ public class CalloutPaymentAllocate extends CalloutEngine rs = pstmt.executeQuery(); if (rs.next()) { - // mTab.setValue("C_BPartner_ID", Integer.valueOf(rs.getInt(1))); - // int C_Currency_ID = rs.getInt(2); // Set Invoice Currency - // mTab.setValue("C_Currency_ID", Integer.valueOf(C_Currency_ID)); // BigDecimal InvoiceOpen = rs.getBigDecimal(3); // Set Invoice OPen Amount if (InvoiceOpen == null) diff --git a/org.adempiere.base.callout/src/org/compiere/model/CalloutProcessCustomization.java b/org.adempiere.base.callout/src/org/compiere/model/CalloutProcessCustomization.java index 63b6b2fa86..fcea70f613 100644 --- a/org.adempiere.base.callout/src/org/compiere/model/CalloutProcessCustomization.java +++ b/org.adempiere.base.callout/src/org/compiere/model/CalloutProcessCustomization.java @@ -60,10 +60,6 @@ public class CalloutProcessCustomization extends CalloutEngine return ""; MProcessPara pp = new MProcessPara(ctx, (Integer) value, null); - - // mTab.setValue("Name", pp.get_Translation("Name")); - // mTab.setValue("Description", pp.get_Translation("Description")); - // mTab.setValue("Help", pp.get_Translation("Help")); mTab.setValue("IsRange", pp.isRange()); return NO_ERROR;