BF [ 1874419 ] JDBC Statement not close in a finally block - for ProductCost, Tax, Env, Msg
This commit is contained in:
parent
432cfe0bc9
commit
3eff6ddfe5
|
@ -16,12 +16,16 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.math.*;
|
import java.math.BigDecimal;
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.sql.SQLException;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Cost Model.
|
* Product Cost Model.
|
||||||
|
@ -158,21 +162,25 @@ public class ProductCost
|
||||||
+ "WHERE M_Product_ID=? AND C_AcctSchema_ID=?";
|
+ "WHERE M_Product_ID=? AND C_AcctSchema_ID=?";
|
||||||
//
|
//
|
||||||
int validCombination_ID = 0;
|
int validCombination_ID = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
validCombination_ID = rs.getInt(AcctType);
|
validCombination_ID = rs.getInt(AcctType);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (validCombination_ID == 0)
|
if (validCombination_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
return MAccount.get(as.getCtx(), validCombination_ID);
|
return MAccount.get(as.getCtx(), validCombination_ID);
|
||||||
|
@ -200,20 +208,24 @@ public class ProductCost
|
||||||
+ "ORDER BY pc.IsDefault DESC, pc.Created";
|
+ "ORDER BY pc.IsDefault DESC, pc.Created";
|
||||||
//
|
//
|
||||||
int validCombination_ID = 0;
|
int validCombination_ID = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, as.getC_AcctSchema_ID());
|
pstmt.setInt(1, as.getC_AcctSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
validCombination_ID = rs.getInt(AcctType);
|
validCombination_ID = rs.getInt(AcctType);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (validCombination_ID == 0)
|
if (validCombination_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
return MAccount.get(as.getCtx(), validCombination_ID);
|
return MAccount.get(as.getCtx(), validCombination_ID);
|
||||||
|
@ -296,24 +308,28 @@ public class ProductCost
|
||||||
sql.append("COSTSTANDARD");
|
sql.append("COSTSTANDARD");
|
||||||
sql.append(" FROM M_Product_Costing WHERE M_Product_ID=? AND C_AcctSchema_ID=?");
|
sql.append(" FROM M_Product_Costing WHERE M_Product_ID=? AND C_AcctSchema_ID=?");
|
||||||
|
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
pstmt.setInt(2, as.getC_AcctSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
current = rs.getBigDecimal(1);
|
current = rs.getBigDecimal(1);
|
||||||
cost = rs.getBigDecimal(2);
|
cost = rs.getBigDecimal(2);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Return Costs
|
// Return Costs
|
||||||
if (costType != null && cost != null && !cost.equals(Env.ZERO))
|
if (costType != null && cost != null && !cost.equals(Env.ZERO))
|
||||||
|
@ -415,11 +431,13 @@ public class ProductCost
|
||||||
BigDecimal PriceList = null;
|
BigDecimal PriceList = null;
|
||||||
BigDecimal PriceStd = null;
|
BigDecimal PriceStd = null;
|
||||||
BigDecimal PriceLimit = null;
|
BigDecimal PriceLimit = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
C_Currency_ID = rs.getInt(1);
|
C_Currency_ID = rs.getInt(1);
|
||||||
|
@ -427,13 +445,15 @@ public class ProductCost
|
||||||
PriceStd = rs.getBigDecimal(3);
|
PriceStd = rs.getBigDecimal(3);
|
||||||
PriceLimit = rs.getBigDecimal(4);
|
PriceLimit = rs.getBigDecimal(4);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
// nothing found
|
// nothing found
|
||||||
if (C_Currency_ID == 0)
|
if (C_Currency_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
@ -466,11 +486,13 @@ public class ProductCost
|
||||||
BigDecimal PriceList = null;
|
BigDecimal PriceList = null;
|
||||||
BigDecimal PricePO = null;
|
BigDecimal PricePO = null;
|
||||||
BigDecimal PriceLastPO = null;
|
BigDecimal PriceLastPO = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, m_M_Product_ID);
|
pstmt.setInt(1, m_M_Product_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
C_Currency_ID = rs.getInt(1);
|
C_Currency_ID = rs.getInt(1);
|
||||||
|
@ -478,13 +500,15 @@ public class ProductCost
|
||||||
PricePO = rs.getBigDecimal(3);
|
PricePO = rs.getBigDecimal(3);
|
||||||
PriceLastPO = rs.getBigDecimal(4);
|
PriceLastPO = rs.getBigDecimal(4);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
// nothing found
|
// nothing found
|
||||||
if (C_Currency_ID == 0)
|
if (C_Currency_ID == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -16,10 +16,18 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.sql.*;
|
import java.sql.PreparedStatement;
|
||||||
import java.util.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.logging.*;
|
import java.sql.SQLException;
|
||||||
import org.compiere.util.*;
|
import java.sql.Timestamp;
|
||||||
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.util.CLogMgt;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tax Handling
|
* Tax Handling
|
||||||
|
@ -111,7 +119,6 @@ public class Tax
|
||||||
log.warning("No Warehouse - C_Charge_ID=" + C_Charge_ID);
|
log.warning("No Warehouse - C_Charge_ID=" + C_Charge_ID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
String variable = "";
|
|
||||||
int C_TaxCategory_ID = 0;
|
int C_TaxCategory_ID = 0;
|
||||||
int shipFromC_Location_ID = 0;
|
int shipFromC_Location_ID = 0;
|
||||||
int shipToC_Location_ID = 0;
|
int shipToC_Location_ID = 0;
|
||||||
|
@ -130,15 +137,17 @@ public class Tax
|
||||||
+ " AND il.C_BPartner_Location_ID=?"
|
+ " AND il.C_BPartner_Location_ID=?"
|
||||||
+ " AND w.M_Warehouse_ID=?"
|
+ " AND w.M_Warehouse_ID=?"
|
||||||
+ " AND sl.C_BPartner_Location_ID=?";
|
+ " AND sl.C_BPartner_Location_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, C_Charge_ID);
|
pstmt.setInt (1, C_Charge_ID);
|
||||||
pstmt.setInt (2, AD_Org_ID);
|
pstmt.setInt (2, AD_Org_ID);
|
||||||
pstmt.setInt (3, billC_BPartner_Location_ID);
|
pstmt.setInt (3, billC_BPartner_Location_ID);
|
||||||
pstmt.setInt (4, M_Warehouse_ID);
|
pstmt.setInt (4, M_Warehouse_ID);
|
||||||
pstmt.setInt (5, shipC_BPartner_Location_ID);
|
pstmt.setInt (5, shipC_BPartner_Location_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
|
@ -150,8 +159,7 @@ public class Tax
|
||||||
shipToC_Location_ID = rs.getInt (6);
|
shipToC_Location_ID = rs.getInt (6);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close ();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
|
||||||
//
|
//
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
|
@ -169,6 +177,10 @@ public class Tax
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Reverese for PO
|
// Reverese for PO
|
||||||
if (!IsSOTrx)
|
if (!IsSOTrx)
|
||||||
|
@ -230,6 +242,8 @@ public class Tax
|
||||||
int billToC_Location_ID = 0;
|
int billToC_Location_ID = 0;
|
||||||
String IsTaxExempt = null;
|
String IsTaxExempt = null;
|
||||||
|
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Get all at once
|
// Get all at once
|
||||||
|
@ -243,13 +257,13 @@ public class Tax
|
||||||
+ " AND il.C_BPartner_Location_ID=?"
|
+ " AND il.C_BPartner_Location_ID=?"
|
||||||
+ " AND w.M_Warehouse_ID=?"
|
+ " AND w.M_Warehouse_ID=?"
|
||||||
+ " AND sl.C_BPartner_Location_ID=?";
|
+ " AND sl.C_BPartner_Location_ID=?";
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, M_Product_ID);
|
pstmt.setInt(1, M_Product_ID);
|
||||||
pstmt.setInt(2, AD_Org_ID);
|
pstmt.setInt(2, AD_Org_ID);
|
||||||
pstmt.setInt(3, billC_BPartner_Location_ID);
|
pstmt.setInt(3, billC_BPartner_Location_ID);
|
||||||
pstmt.setInt(4, M_Warehouse_ID);
|
pstmt.setInt(4, M_Warehouse_ID);
|
||||||
pstmt.setInt(5, shipC_BPartner_Location_ID);
|
pstmt.setInt(5, shipC_BPartner_Location_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -261,8 +275,7 @@ public class Tax
|
||||||
shipToC_Location_ID = rs.getInt(6);
|
shipToC_Location_ID = rs.getInt(6);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
//
|
//
|
||||||
if (found && "Y".equals(IsTaxExempt))
|
if (found && "Y".equals(IsTaxExempt))
|
||||||
{
|
{
|
||||||
|
@ -307,8 +320,7 @@ public class Tax
|
||||||
C_TaxCategory_ID = rs.getInt(1);
|
C_TaxCategory_ID = rs.getInt(1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
if (C_TaxCategory_ID == 0)
|
if (C_TaxCategory_ID == 0)
|
||||||
{
|
{
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.translate(ctx, variable)
|
log.saveError("TaxCriteriaNotFound", Msg.translate(ctx, variable)
|
||||||
|
@ -330,8 +342,7 @@ public class Tax
|
||||||
billFromC_Location_ID = rs.getInt (1);
|
billFromC_Location_ID = rs.getInt (1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
if (billFromC_Location_ID == 0)
|
if (billFromC_Location_ID == 0)
|
||||||
{
|
{
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
||||||
|
@ -354,8 +365,7 @@ public class Tax
|
||||||
IsTaxExempt = rs.getString(2);
|
IsTaxExempt = rs.getString(2);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
if (billToC_Location_ID == 0)
|
if (billToC_Location_ID == 0)
|
||||||
{
|
{
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
||||||
|
@ -390,8 +400,7 @@ public class Tax
|
||||||
shipFromC_Location_ID = rs.getInt (1);
|
shipFromC_Location_ID = rs.getInt (1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
if (shipFromC_Location_ID == 0)
|
if (shipFromC_Location_ID == 0)
|
||||||
{
|
{
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
||||||
|
@ -412,8 +421,7 @@ public class Tax
|
||||||
shipToC_Location_ID = rs.getInt (1);
|
shipToC_Location_ID = rs.getInt (1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
|
||||||
if (shipToC_Location_ID == 0)
|
if (shipToC_Location_ID == 0)
|
||||||
{
|
{
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
log.saveError("TaxCriteriaNotFound", Msg.translate(Env.getAD_Language(ctx), variable)
|
||||||
|
@ -435,6 +443,12 @@ public class Tax
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "getProduct (" + variable + ")", e);
|
log.log(Level.SEVERE, "getProduct (" + variable + ")", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs);
|
||||||
|
DB.close(pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
return get (ctx, C_TaxCategory_ID, IsSOTrx,
|
return get (ctx, C_TaxCategory_ID, IsSOTrx,
|
||||||
shipDate, shipFromC_Location_ID, shipToC_Location_ID,
|
shipDate, shipFromC_Location_ID, shipToC_Location_ID,
|
||||||
|
@ -456,23 +470,27 @@ public class Tax
|
||||||
+ "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID=? "
|
+ "WHERE t.IsTaxExempt='Y' AND o.AD_Org_ID=? "
|
||||||
+ "ORDER BY t.Rate DESC";
|
+ "ORDER BY t.Rate DESC";
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Org_ID);
|
pstmt.setInt(1, AD_Org_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
C_Tax_ID = rs.getInt (1);
|
C_Tax_ID = rs.getInt (1);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "getExemptTax", e);
|
log.log(Level.SEVERE, "getExemptTax", e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
log.fine("getExemptTax - TaxExempt=Y - C_Tax_ID=" + C_Tax_ID);
|
log.fine("getExemptTax - TaxExempt=Y - C_Tax_ID=" + C_Tax_ID);
|
||||||
if (C_Tax_ID == 0)
|
if (C_Tax_ID == 0)
|
||||||
log.saveError("TaxCriteriaNotFound", Msg.getMsg(ctx, "TaxNoExemptFound")
|
log.saveError("TaxCriteriaNotFound", Msg.getMsg(ctx, "TaxNoExemptFound")
|
||||||
|
|
|
@ -961,10 +961,12 @@ public final class Env
|
||||||
boolean isSystemLanguage = false;
|
boolean isSystemLanguage = false;
|
||||||
ArrayList<String> AD_Languages = new ArrayList<String>();
|
ArrayList<String> AD_Languages = new ArrayList<String>();
|
||||||
String sql = "SELECT DISTINCT AD_Language FROM AD_Message_Trl";
|
String sql = "SELECT DISTINCT AD_Language FROM AD_Message_Trl";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String AD_Language = rs.getString(1);
|
String AD_Language = rs.getString(1);
|
||||||
|
@ -975,13 +977,15 @@ public final class Env
|
||||||
}
|
}
|
||||||
AD_Languages.add(AD_Language);
|
AD_Languages.add(AD_Language);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "", e);
|
s_log.log(Level.SEVERE, "", e);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
// Found it
|
// Found it
|
||||||
if (isSystemLanguage)
|
if (isSystemLanguage)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -108,9 +108,10 @@ public final class Msg
|
||||||
s_log.log(Level.SEVERE, "No DB Connection");
|
s_log.log(Level.SEVERE, "No DB Connection");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
if (AD_Language == null || AD_Language.length() == 0 || Env.isBaseLanguage(AD_Language, "AD_Language"))
|
if (AD_Language == null || AD_Language.length() == 0 || Env.isBaseLanguage(AD_Language, "AD_Language"))
|
||||||
pstmt = DB.prepareStatement("SELECT Value, MsgText, MsgTip FROM AD_Message", null);
|
pstmt = DB.prepareStatement("SELECT Value, MsgText, MsgTip FROM AD_Message", null);
|
||||||
else
|
else
|
||||||
|
@ -121,7 +122,7 @@ public final class Msg
|
||||||
+ " AND t.AD_Language=?", null);
|
+ " AND t.AD_Language=?", null);
|
||||||
pstmt.setString(1, AD_Language);
|
pstmt.setString(1, AD_Language);
|
||||||
}
|
}
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
// get values
|
// get values
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
|
@ -135,15 +136,16 @@ public final class Msg
|
||||||
MsgText.append(" ").append(SEPARATOR).append(MsgTip);
|
MsgText.append(" ").append(SEPARATOR).append(MsgTip);
|
||||||
msg.put(AD_Message, MsgText.toString());
|
msg.put(AD_Message, MsgText.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "initMsg", e);
|
s_log.log(Level.SEVERE, "initMsg", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
if (msg.size() < 100)
|
if (msg.size() < 100)
|
||||||
{
|
{
|
||||||
|
@ -460,9 +462,10 @@ public final class Msg
|
||||||
|
|
||||||
// Check AD_Element
|
// Check AD_Element
|
||||||
String retStr = "";
|
String retStr = "";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (AD_Language == null || AD_Language.length() == 0 || Env.isBaseLanguage(AD_Language, "AD_Element"))
|
if (AD_Language == null || AD_Language.length() == 0 || Env.isBaseLanguage(AD_Language, "AD_Element"))
|
||||||
|
@ -479,8 +482,12 @@ public final class Msg
|
||||||
{
|
{
|
||||||
return ColumnName;
|
return ColumnName;
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs);
|
||||||
|
rs = null;
|
||||||
|
}
|
||||||
pstmt.setString(1, ColumnName.toUpperCase());
|
pstmt.setString(1, ColumnName.toUpperCase());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
retStr = rs.getString(1);
|
retStr = rs.getString(1);
|
||||||
|
@ -491,14 +498,16 @@ public final class Msg
|
||||||
retStr = temp;
|
retStr = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getElement", e);
|
s_log.log(Level.SEVERE, "getElement", e);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
|
}
|
||||||
if (retStr != null)
|
if (retStr != null)
|
||||||
return retStr.trim();
|
return retStr.trim();
|
||||||
return retStr;
|
return retStr;
|
||||||
|
|
Loading…
Reference in New Issue