org.compiere.acct.DocTax: fix db connection

This commit is contained in:
teo_sarca 2008-06-30 06:53:58 +00:00
parent d533ea444d
commit a0884d2c93
1 changed files with 8 additions and 4 deletions

View File

@ -93,21 +93,25 @@ public final class DocTax
String sql = "SELECT T_Due_Acct, T_Liability_Acct, T_Credit_Acct, T_Receivables_Acct, T_Expense_Acct "
+ "FROM C_Tax_Acct WHERE C_Tax_ID=? AND C_AcctSchema_ID=?";
int validCombination_ID = 0;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
PreparedStatement pstmt = DB.prepareStatement(sql, null);
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, m_C_Tax_ID);
pstmt.setInt(2, as.getC_AcctSchema_ID());
ResultSet rs = pstmt.executeQuery();
rs = pstmt.executeQuery();
if (rs.next())
validCombination_ID = rs.getInt(AcctType+1); // 1..5
rs.close();
pstmt.close();
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
}
finally {
DB.close(rs, pstmt);
rs = null; pstmt = null;
}
if (validCombination_ID == 0)
return null;
return MAccount.get(as.getCtx(), validCombination_ID);