#resolve IDEMPIERE-4301 Replace MSysConfig.getDouble with getBigDecimal (#71)
This commit is contained in:
parent
bf6fd2bb71
commit
eaf42afd84
|
@ -206,7 +206,6 @@ public class SalesOrderRateInquiryProcess extends SvrProcess
|
|||
String ShipperAccount = ShippingUtil.getSenderShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID());
|
||||
String DutiesShipperAccount = ShippingUtil.getSenderDutiesShipperAccount(shipper.getM_Shipper_ID(), shipper.getAD_Org_ID());
|
||||
|
||||
// 1 kg = 2.20462 lb
|
||||
MClientInfo ci = MClientInfo.get(ctx, m_order.getAD_Client_ID(), trxName);
|
||||
MUOM uom = new MUOM(ctx, ci.getC_UOM_Weight_ID(), null);
|
||||
String unit = uom.getX12DE355();
|
||||
|
@ -218,13 +217,16 @@ public class SalesOrderRateInquiryProcess extends SvrProcess
|
|||
isPound = true;
|
||||
}
|
||||
|
||||
// 1 kg = 2.20462 lb
|
||||
final BigDecimal kgToPound = new BigDecimal("2.20462");
|
||||
MShipperPackaging sp = new MShipperPackaging(ctx, M_ShipperPackaging_ID, trxName);
|
||||
BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE);
|
||||
BigDecimal WeightPerPackage = sp.getWeight().multiply(isPound ? kgToPound : BigDecimal.ONE);
|
||||
|
||||
if (WeightPerPackage == null || WeightPerPackage.compareTo(BigDecimal.ZERO) == 0)
|
||||
{
|
||||
BigDecimal defaultWeightPerPackage = BigDecimal.valueOf(MSysConfig.getDoubleValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, 30));
|
||||
WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? BigDecimal.valueOf(2.20462) : BigDecimal.ONE);
|
||||
final BigDecimal thirty = new BigDecimal("30");
|
||||
BigDecimal defaultWeightPerPackage = MSysConfig.getBigDecimalValue(MSysConfig.SHIPPING_DEFAULT_WEIGHT_PER_PACKAGE, thirty);
|
||||
WeightPerPackage = defaultWeightPerPackage.multiply(isPound ? kgToPound : BigDecimal.ONE);
|
||||
}
|
||||
|
||||
BigDecimal CODAmount = m_order.getGrandTotal();
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
@ -42,7 +43,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9208749663408576569L;
|
||||
private static final long serialVersionUID = -3283099328590831741L;
|
||||
|
||||
public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION";
|
||||
public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS";
|
||||
|
@ -271,12 +272,13 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type double
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @return double
|
||||
* @deprecated use better getBigDecimalValue
|
||||
*/
|
||||
public static double getDoubleValue(String Name, double defaultValue)
|
||||
{
|
||||
|
@ -294,7 +296,30 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type BigDecimal
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal getBigDecimalValue(String Name, BigDecimal defaultValue)
|
||||
{
|
||||
String s = getValue(Name);
|
||||
if (s == null || s.length() == 0)
|
||||
return defaultValue;
|
||||
//
|
||||
try
|
||||
{
|
||||
return new BigDecimal(s);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "getBigDecimalValue (" + Name + ") = " + s, e);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system configuration property of type boolean
|
||||
* @param Name
|
||||
|
@ -364,13 +389,14 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type double
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @param Client ID
|
||||
* @return double
|
||||
* @deprecated use better getBigDecimalValue
|
||||
*/
|
||||
public static double getDoubleValue(String Name, double defaultValue, int AD_Client_ID)
|
||||
{
|
||||
|
@ -388,7 +414,31 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type BigDecimal
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @param Client ID
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal getBigDecimalValue(String Name, BigDecimal defaultValue, int AD_Client_ID)
|
||||
{
|
||||
String s = getValue(Name, AD_Client_ID);
|
||||
if (s == null || s.length() == 0)
|
||||
return defaultValue;
|
||||
//
|
||||
try
|
||||
{
|
||||
return new BigDecimal(s);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "getBigDecimalValue (" + Name + ") = " + s, e);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system configuration property of type boolean
|
||||
* @param Name
|
||||
|
@ -508,7 +558,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type double
|
||||
* @param Name
|
||||
|
@ -516,6 +566,7 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
* @param Client ID
|
||||
* @param Organization ID
|
||||
* @return double
|
||||
* @deprecated use better getBigDecimalValue
|
||||
*/
|
||||
public static double getDoubleValue(String Name, double defaultValue, int AD_Client_ID, int AD_Org_ID)
|
||||
{
|
||||
|
@ -533,7 +584,32 @@ public class MSysConfig extends X_AD_SysConfig
|
|||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get system configuration property of type BigDecimal
|
||||
* @param Name
|
||||
* @param defaultValue
|
||||
* @param Client ID
|
||||
* @param Organization ID
|
||||
* @return BigDecimal
|
||||
*/
|
||||
public static BigDecimal getBigDecimalValue(String Name, BigDecimal defaultValue, int AD_Client_ID, int AD_Org_ID)
|
||||
{
|
||||
String s = getValue(Name, AD_Client_ID, AD_Org_ID);
|
||||
if (s == null || s.length() == 0)
|
||||
return defaultValue;
|
||||
//
|
||||
try
|
||||
{
|
||||
return new BigDecimal(s);
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "getBigDecimalValue (" + Name + ") = " + s, e);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get system configuration property of type boolean
|
||||
* @param Name
|
||||
|
|
Loading…
Reference in New Issue