Merge 49f33f4950c9
This commit is contained in:
commit
d8e7b6ee67
|
@ -90,9 +90,6 @@ public class CalloutGLJournal extends CalloutEngine
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
C_Period_ID = rs.getInt(1);
|
C_Period_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
|
@ -102,6 +99,8 @@ public class CalloutGLJournal extends CalloutEngine
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (C_Period_ID != 0)
|
if (C_Period_ID != 0)
|
||||||
mTab.setValue("C_Period_ID", new Integer(C_Period_ID));
|
mTab.setValue("C_Period_ID", new Integer(C_Period_ID));
|
||||||
|
|
|
@ -155,15 +155,16 @@ public class CalloutInventory extends CalloutEngine
|
||||||
sql = "SELECT SUM(QtyOnHand) FROM M_StorageOnHand "
|
sql = "SELECT SUM(QtyOnHand) FROM M_StorageOnHand "
|
||||||
+ "WHERE M_Product_ID=?" // 1
|
+ "WHERE M_Product_ID=?" // 1
|
||||||
+ " AND M_Locator_ID=?"; // 2
|
+ " AND M_Locator_ID=?"; // 2
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
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, M_Locator_ID);
|
pstmt.setInt(2, M_Locator_ID);
|
||||||
if (M_AttributeSetInstance_ID != 0)
|
if (M_AttributeSetInstance_ID != 0)
|
||||||
pstmt.setInt(3, M_AttributeSetInstance_ID);
|
pstmt.setInt(3, M_AttributeSetInstance_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
bd = rs.getBigDecimal(1);
|
bd = rs.getBigDecimal(1);
|
||||||
|
@ -174,14 +175,19 @@ public class CalloutInventory extends CalloutEngine
|
||||||
// for example when the locator has never stored a particular product.
|
// for example when the locator has never stored a particular product.
|
||||||
return new BigDecimal(0);
|
return new BigDecimal(0);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
throw new Exception(e.getLocalizedMessage());
|
throw new Exception(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
return new BigDecimal(0);
|
return new BigDecimal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,24 +88,30 @@ public class CalloutRequest extends CalloutEngine
|
||||||
Integer R_StandardResponse_ID = (Integer)value;
|
Integer R_StandardResponse_ID = (Integer)value;
|
||||||
String sql = "SELECT Name, ResponseText FROM R_StandardResponse "
|
String sql = "SELECT Name, ResponseText FROM R_StandardResponse "
|
||||||
+ "WHERE R_StandardResponse_ID=?";
|
+ "WHERE R_StandardResponse_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, R_StandardResponse_ID.intValue());
|
pstmt.setInt(1, R_StandardResponse_ID.intValue());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
String txt = rs.getString(2);
|
String txt = rs.getString(2);
|
||||||
txt = Env.parseContext(ctx, WindowNo, txt, false, true);
|
txt = Env.parseContext(ctx, WindowNo, txt, false, true);
|
||||||
mTab.setValue("Result", txt);
|
mTab.setValue("Result", txt);
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
return "";
|
return "";
|
||||||
} // copyResponse
|
} // copyResponse
|
||||||
|
|
||||||
|
|
|
@ -44,67 +44,73 @@ import org.compiere.util.DB;
|
||||||
public class ApplyMigrationScripts extends SvrProcess {
|
public class ApplyMigrationScripts extends SvrProcess {
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger
|
private static CLogger log = CLogger.getCLogger(ApplyMigrationScripts.class);
|
||||||
.getCLogger(ApplyMigrationScripts.class);
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doIt() throws Exception {
|
protected String doIt() throws Exception {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
log.info("Applying migrations scripts");
|
log.info("Applying migrations scripts");
|
||||||
StringBuilder sql = new StringBuilder()
|
StringBuilder sql = new StringBuilder()
|
||||||
.append("select ad_migrationscript_id, script, name from ad_migrationscript where isApply = 'Y' and status = 'IP' order by name, created");
|
.append("select ad_migrationscript_id, script, name from ad_migrationscript where isApply = 'Y' and status = 'IP' order by name, created");
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), this.get_TrxName());
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = null;
|
||||||
while (rs.next()) {
|
try {
|
||||||
byte[] scriptArray = rs.getBytes(2);
|
pstmt = DB.prepareStatement(sql.toString(), this.get_TrxName());
|
||||||
int seqID = rs.getInt(1);
|
rs = pstmt.executeQuery();
|
||||||
boolean execOk = true;
|
while (rs.next()) {
|
||||||
try {
|
byte[] scriptArray = rs.getBytes(2);
|
||||||
StringBuilder tmpSql = new StringBuilder(new String(scriptArray));
|
int seqID = rs.getInt(1);
|
||||||
|
boolean execOk = true;
|
||||||
if (tmpSql.length() > 0) {
|
|
||||||
log.info("Executing script " + rs.getString(3));
|
|
||||||
execOk = executeScript(tmpSql.toString(), rs.getString(3));
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
execOk = false;
|
|
||||||
e.printStackTrace();
|
|
||||||
StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
|
|
||||||
log.saveError("Error", msglog.toString());
|
|
||||||
log.severe(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
sql = new StringBuilder("UPDATE ad_migrationscript SET status = ? , isApply = 'N' WHERE ad_migrationscript_id = ? ");
|
|
||||||
pstmt = DB.prepareStatement(sql.toString(), this.get_TrxName());
|
|
||||||
if (execOk) {
|
|
||||||
pstmt.setString(1, "CO");
|
|
||||||
pstmt.setInt(2, seqID);
|
|
||||||
} else {
|
|
||||||
pstmt.setString(1, "ER");
|
|
||||||
pstmt.setInt(2, seqID);
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
pstmt.executeUpdate();
|
StringBuilder tmpSql = new StringBuilder(new String(scriptArray));
|
||||||
if (!execOk) {
|
|
||||||
pstmt.close();
|
if (tmpSql.length() > 0) {
|
||||||
return null;
|
log.info("Executing script " + rs.getString(3));
|
||||||
|
execOk = executeScript(tmpSql.toString(), rs.getString(3));
|
||||||
|
System.out.println();
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
|
execOk = false;
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
|
StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
|
||||||
log.saveError("Error", msglog.toString());
|
log.saveError("Error", msglog.toString());
|
||||||
log.severe(e.getMessage());
|
log.severe(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
sql = new StringBuilder("UPDATE ad_migrationscript SET status = ? , isApply = 'N' WHERE ad_migrationscript_id = ? ");
|
||||||
|
PreparedStatement pstmtu = DB.prepareStatement(sql.toString(), this.get_TrxName());
|
||||||
|
if (execOk) {
|
||||||
|
pstmtu.setString(1, "CO");
|
||||||
|
pstmtu.setInt(2, seqID);
|
||||||
|
} else {
|
||||||
|
pstmtu.setString(1, "ER");
|
||||||
|
pstmtu.setInt(2, seqID);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
pstmtu.executeUpdate();
|
||||||
|
if (!execOk) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
StringBuilder msglog = new StringBuilder("Script: ").append(rs.getString(3)).append(" - ").append(e.getMessage());
|
||||||
|
log.saveError("Error", msglog.toString());
|
||||||
|
log.severe(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
DB.close(pstmtu);
|
||||||
|
pstmtu = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null; pstmt = null;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void prepare() {
|
protected void prepare() {
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +162,8 @@ public class ApplyMigrationScripts extends SvrProcess {
|
||||||
log.saveError("Error", msglog.toString());
|
log.saveError("Error", msglog.toString());
|
||||||
log.severe(e.getMessage());
|
log.severe(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
if (stmt != null)stmt.close();
|
DB.close(stmt);
|
||||||
|
stmt = null;
|
||||||
if(execOk)
|
if(execOk)
|
||||||
conn.commit();
|
conn.commit();
|
||||||
else
|
else
|
||||||
|
|
|
@ -81,6 +81,7 @@ public class ColumnSync extends SvrProcess
|
||||||
|
|
||||||
// Find Column in Database
|
// Find Column in Database
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
conn = DB.getConnectionRO();
|
conn = DB.getConnectionRO();
|
||||||
DatabaseMetaData md = conn.getMetaData();
|
DatabaseMetaData md = conn.getMetaData();
|
||||||
|
@ -98,7 +99,7 @@ public class ColumnSync extends SvrProcess
|
||||||
int noColumns = 0;
|
int noColumns = 0;
|
||||||
String sql = null;
|
String sql = null;
|
||||||
//
|
//
|
||||||
ResultSet rs = md.getColumns(catalog, schema, tableName, null);
|
rs = md.getColumns(catalog, schema, tableName, null);
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
noColumns++;
|
noColumns++;
|
||||||
|
@ -111,7 +112,7 @@ public class ColumnSync extends SvrProcess
|
||||||
sql = column.getSQLModify(table, column.isMandatory() != notNull);
|
sql = column.getSQLModify(table, column.isMandatory() != notNull);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
rs.close();
|
DB.close(rs);
|
||||||
rs = null;
|
rs = null;
|
||||||
|
|
||||||
// No Table
|
// No Table
|
||||||
|
@ -149,6 +150,8 @@ public class ColumnSync extends SvrProcess
|
||||||
}
|
}
|
||||||
return sql;
|
return sql;
|
||||||
} finally {
|
} finally {
|
||||||
|
DB.close(rs);
|
||||||
|
rs = null;
|
||||||
if (conn != null) {
|
if (conn != null) {
|
||||||
try {
|
try {
|
||||||
conn.close();
|
conn.close();
|
||||||
|
|
|
@ -193,6 +193,7 @@ public class CostUpdate extends SvrProcess
|
||||||
sql += " AND M_Product_Category_ID=?";
|
sql += " AND M_Product_Category_ID=?";
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
|
@ -202,28 +203,21 @@ public class CostUpdate extends SvrProcess
|
||||||
pstmt.setInt (4, as.getAD_Client_ID());
|
pstmt.setInt (4, as.getAD_Client_ID());
|
||||||
if (p_M_Product_Category_ID != 0)
|
if (p_M_Product_Category_ID != 0)
|
||||||
pstmt.setInt (5, p_M_Product_Category_ID);
|
pstmt.setInt (5, p_M_Product_Category_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
if (createNew (new MProduct (getCtx(), rs, null), as))
|
if (createNew (new MProduct (getCtx(), rs, null), as))
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
log.info("#" + counter);
|
log.info("#" + counter);
|
||||||
|
@ -256,13 +250,14 @@ public class CostUpdate extends SvrProcess
|
||||||
sql += " AND EXISTS (SELECT * FROM M_Product p "
|
sql += " AND EXISTS (SELECT * FROM M_Product p "
|
||||||
+ "WHERE c.M_Product_ID=p.M_Product_ID AND p.M_Product_Category_ID=?)";
|
+ "WHERE c.M_Product_ID=p.M_Product_ID AND p.M_Product_Category_ID=?)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
||||||
if (p_M_Product_Category_ID != 0)
|
if (p_M_Product_Category_ID != 0)
|
||||||
pstmt.setInt (2, p_M_Product_Category_ID);
|
pstmt.setInt (2, p_M_Product_Category_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MCost cost = new MCost (getCtx(), rs, get_TrxName());
|
MCost cost = new MCost (getCtx(), rs, get_TrxName());
|
||||||
|
@ -277,22 +272,15 @@ public class CostUpdate extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
log.info("#" + counter);
|
log.info("#" + counter);
|
||||||
|
@ -502,32 +490,26 @@ public class CostUpdate extends SvrProcess
|
||||||
+ "FROM M_ProductPrice "
|
+ "FROM M_ProductPrice "
|
||||||
+ "WHERE M_Product_ID=? AND M_PriceList_Version_ID=?";
|
+ "WHERE M_Product_ID=? AND M_PriceList_Version_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, cost.getM_Product_ID());
|
pstmt.setInt (1, cost.getM_Product_ID());
|
||||||
pstmt.setInt (2, p_M_PriceList_Version_ID);
|
pstmt.setInt (2, p_M_PriceList_Version_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
retValue = rs.getBigDecimal(1);
|
retValue = rs.getBigDecimal(1);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
|
@ -78,11 +78,12 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
+ " AND rl.IsActive='Y' AND NOT EXISTS "
|
+ " AND rl.IsActive='Y' AND NOT EXISTS "
|
||||||
+ " (SELECT * FROM C_DocType dt WHERE dt.AD_Client_ID=? AND rl.Value=dt.DocBaseType)";
|
+ " (SELECT * FROM C_DocType dt WHERE dt.AD_Client_ID=? AND rl.Value=dt.DocBaseType)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
pstmt.setInt(1, AD_Client_ID);
|
pstmt.setInt(1, AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String name = rs.getString(2);
|
String name = rs.getString(2);
|
||||||
|
@ -104,22 +105,15 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
s_log.warning("Not created: " + name);
|
s_log.warning("Not created: " + name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
} // createDocumentTypes
|
} // createDocumentTypes
|
||||||
|
@ -160,12 +154,13 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
+ " (SELECT * FROM C_PeriodControl pc "
|
+ " (SELECT * FROM C_PeriodControl pc "
|
||||||
+ "WHERE pc.C_Period_ID=p.C_Period_ID AND pc.DocBaseType=dt.DocBaseType)";
|
+ "WHERE pc.C_Period_ID=p.C_Period_ID AND pc.DocBaseType=dt.DocBaseType)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
pstmt.setInt(1, AD_Client_ID);
|
pstmt.setInt(1, AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int Client_ID = rs.getInt(1);
|
int Client_ID = rs.getInt(1);
|
||||||
|
@ -184,22 +179,15 @@ public class DocumentTypeVerify extends SvrProcess
|
||||||
else
|
else
|
||||||
s_log.warning("Not saved: " + pc);
|
s_log.warning("Not saved: " + pc);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
|
|
|
@ -203,6 +203,7 @@ public class DunningRunCreate extends SvrProcess
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
PreparedStatement pstmt2 = null;
|
PreparedStatement pstmt2 = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
ResultSet rs2 = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
|
@ -255,13 +256,14 @@ public class DunningRunCreate extends SvrProcess
|
||||||
// SubQuery
|
// SubQuery
|
||||||
pstmt2.setInt (1, m_run.get_ID ());
|
pstmt2.setInt (1, m_run.get_ID ());
|
||||||
pstmt2.setInt (2, C_Invoice_ID);
|
pstmt2.setInt (2, C_Invoice_ID);
|
||||||
ResultSet rs2 = pstmt2.executeQuery ();
|
rs2 = pstmt2.executeQuery ();
|
||||||
if (rs2.next())
|
if (rs2.next())
|
||||||
{
|
{
|
||||||
TimesDunned = rs2.getInt(1);
|
TimesDunned = rs2.getInt(1);
|
||||||
DaysAfterLast = rs2.getInt(2);
|
DaysAfterLast = rs2.getInt(2);
|
||||||
}
|
}
|
||||||
rs2.close();
|
DB.close(rs2);
|
||||||
|
rs2 = null;
|
||||||
// SubQuery
|
// SubQuery
|
||||||
|
|
||||||
// Ensure that Daysbetween Dunning is enforced
|
// Ensure that Daysbetween Dunning is enforced
|
||||||
|
@ -298,7 +300,8 @@ public class DunningRunCreate extends SvrProcess
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
rs = null; pstmt = null; pstmt2 = null;
|
DB.close(rs2, pstmt2);
|
||||||
|
rs = null; pstmt = null; rs2 = null; pstmt2 = null;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
} // addInvoices
|
} // addInvoices
|
||||||
|
|
|
@ -112,10 +112,11 @@ public class FactAcctReset extends SvrProcess
|
||||||
sql += " AND EXISTS (SELECT * FROM AD_Column c "
|
sql += " AND EXISTS (SELECT * FROM AD_Column c "
|
||||||
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted' AND c.IsActive='Y')";
|
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted' AND c.IsActive='Y')";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int AD_Table_ID = rs.getInt(1);
|
int AD_Table_ID = rs.getInt(1);
|
||||||
|
@ -125,22 +126,15 @@ public class FactAcctReset extends SvrProcess
|
||||||
else
|
else
|
||||||
reset (TableName);
|
reset (TableName);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -264,10 +264,12 @@ public class ImportAccount extends SvrProcess
|
||||||
.append("FROM I_ElementValue ")
|
.append("FROM I_ElementValue ")
|
||||||
.append("WHERE I_IsImported='N'").append(clientCheck)
|
.append("WHERE I_IsImported='N'").append(clientCheck)
|
||||||
.append(" ORDER BY I_ElementValue_ID");
|
.append(" ORDER BY I_ElementValue_ID");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
X_I_ElementValue impEV = new X_I_ElementValue(getCtx(), rs, get_TrxName());
|
X_I_ElementValue impEV = new X_I_ElementValue(getCtx(), rs, get_TrxName());
|
||||||
|
@ -316,13 +318,17 @@ public class ImportAccount extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for all I_Product
|
} // for all I_Product
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
throw new Exception ("create", e);
|
throw new Exception ("create", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_ElementValue ")
|
sql = new StringBuilder ("UPDATE I_ElementValue ")
|
||||||
|
@ -362,8 +368,8 @@ public class ImportAccount extends SvrProcess
|
||||||
int noParentUpdate = 0;
|
int noParentUpdate = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
String updateSQL = "UPDATE AD_TreeNode SET Parent_ID=?, SeqNo=? "
|
String updateSQL = "UPDATE AD_TreeNode SET Parent_ID=?, SeqNo=? "
|
||||||
+ "WHERE AD_Tree_ID=? AND Node_ID=?";
|
+ "WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||||
|
@ -391,13 +397,17 @@ public class ImportAccount extends SvrProcess
|
||||||
if (no == 0)
|
if (no == 0)
|
||||||
log.info("Parent not found for " + rs.getString(5));
|
log.info("Parent not found for " + rs.getString(5));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "(ParentUpdateLoop) " + sql.toString(), e);
|
log.log(Level.SEVERE, "(ParentUpdateLoop) " + sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
addLog (0, null, new BigDecimal (noParentUpdate), "@ParentElementValue_ID@: @Updated@");
|
addLog (0, null, new BigDecimal (noParentUpdate), "@ParentElementValue_ID@: @Updated@");
|
||||||
|
|
||||||
commitEx();
|
commitEx();
|
||||||
|
@ -444,20 +454,26 @@ public class ImportAccount extends SvrProcess
|
||||||
// **** Update Defaults
|
// **** Update Defaults
|
||||||
StringBuilder sql = new StringBuilder ("SELECT C_AcctSchema_ID FROM C_AcctSchema_Element ")
|
StringBuilder sql = new StringBuilder ("SELECT C_AcctSchema_ID FROM C_AcctSchema_Element ")
|
||||||
.append("WHERE C_Element_ID=?").append(clientCheck);
|
.append("WHERE C_Element_ID=?").append(clientCheck);
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
pstmt.setInt(1, m_C_Element_ID);
|
pstmt.setInt(1, m_C_Element_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
updateDefaultAccounts (rs.getInt(1));
|
updateDefaultAccounts (rs.getInt(1));
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
// Default Account DEFAULT_ACCT
|
// Default Account DEFAULT_ACCT
|
||||||
sql = new StringBuilder ("UPDATE C_AcctSchema_Element e ")
|
sql = new StringBuilder ("UPDATE C_AcctSchema_Element e ")
|
||||||
|
@ -498,11 +514,13 @@ public class ImportAccount extends SvrProcess
|
||||||
.append(" INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) ")
|
.append(" INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) ")
|
||||||
.append("WHERE i.I_IsImported='Y' AND Processing='Y'")
|
.append("WHERE i.I_IsImported='Y' AND Processing='Y'")
|
||||||
.append(" AND i.C_ElementValue_ID IS NOT NULL AND C_Element_ID=?");
|
.append(" AND i.C_ElementValue_ID IS NOT NULL AND C_Element_ID=?");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
pstmt.setInt(1, m_C_Element_ID);
|
pstmt.setInt(1, m_C_Element_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int C_ElementValue_ID = rs.getInt(1);
|
int C_ElementValue_ID = rs.getInt(1);
|
||||||
|
@ -521,13 +539,17 @@ public class ImportAccount extends SvrProcess
|
||||||
log.log(Level.SEVERE, "Updated=" + no);
|
log.log(Level.SEVERE, "Updated=" + no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "", e);
|
log.log(Level.SEVERE, "", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
addLog (0, null, new BigDecimal (counts[UPDATE_ERROR]), as.toString() + ": @Errors@");
|
addLog (0, null, new BigDecimal (counts[UPDATE_ERROR]), as.toString() + ": @Errors@");
|
||||||
addLog (0, null, new BigDecimal (counts[UPDATE_YES]), as.toString() + ": @Updated@");
|
addLog (0, null, new BigDecimal (counts[UPDATE_YES]), as.toString() + ": @Updated@");
|
||||||
addLog (0, null, new BigDecimal (counts[UPDATE_SAME]), as.toString() + ": OK");
|
addLog (0, null, new BigDecimal (counts[UPDATE_SAME]), as.toString() + ": OK");
|
||||||
|
@ -562,10 +584,12 @@ public class ImportAccount extends SvrProcess
|
||||||
.append(TableName).append(" x INNER JOIN C_ValidCombination vc ON (x.")
|
.append(TableName).append(" x INNER JOIN C_ValidCombination vc ON (x.")
|
||||||
.append(ColumnName).append("=vc.C_ValidCombination_ID) ")
|
.append(ColumnName).append("=vc.C_ValidCombination_ID) ")
|
||||||
.append("WHERE x.C_AcctSchema_ID=").append(C_AcctSchema_ID);
|
.append("WHERE x.C_AcctSchema_ID=").append(C_AcctSchema_ID);
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
int C_ValidCombination_ID = rs.getInt(1);
|
int C_ValidCombination_ID = rs.getInt(1);
|
||||||
|
@ -635,13 +659,17 @@ public class ImportAccount extends SvrProcess
|
||||||
} // for all default accounts
|
} // for all default accounts
|
||||||
else
|
else
|
||||||
log.log(Level.SEVERE, "Account not found " + sql);
|
log.log(Level.SEVERE, "Account not found " + sql);
|
||||||
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 retValue;
|
return retValue;
|
||||||
} // updateDefaultAccount
|
} // updateDefaultAccount
|
||||||
|
|
|
@ -329,11 +329,12 @@ public class ImportBankStatement extends SvrProcess
|
||||||
PreparedStatement pupdt = DB.prepareStatement(updateSql.toString(), get_TrxName());
|
PreparedStatement pupdt = DB.prepareStatement(updateSql.toString(), get_TrxName());
|
||||||
|
|
||||||
PreparedStatement pstmtDuplicates = null;
|
PreparedStatement pstmtDuplicates = null;
|
||||||
|
ResultSet rs = null;
|
||||||
no = 0;
|
no = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmtDuplicates = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmtDuplicates = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmtDuplicates.executeQuery();
|
rs = pstmtDuplicates.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
StringBuilder info = new StringBuilder("Line_ID=").append(rs.getInt(2)) // l.C_BankStatementLine_ID
|
StringBuilder info = new StringBuilder("Line_ID=").append(rs.getInt(2)) // l.C_BankStatementLine_ID
|
||||||
|
@ -343,18 +344,18 @@ public class ImportBankStatement extends SvrProcess
|
||||||
pupdt.executeUpdate();
|
pupdt.executeUpdate();
|
||||||
no++;
|
no++;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmtDuplicates.close();
|
|
||||||
pupdt.close();
|
|
||||||
|
|
||||||
rs = null;
|
|
||||||
pstmtDuplicates = null;
|
|
||||||
pupdt = null;
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "DetectDuplicates " + e.getMessage());
|
log.log(Level.SEVERE, "DetectDuplicates " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmtDuplicates);
|
||||||
|
rs = null;pstmtDuplicates = null;
|
||||||
|
DB.close(pupdt);
|
||||||
|
pupdt = null;
|
||||||
|
}
|
||||||
if (no != 0)
|
if (no != 0)
|
||||||
log.info("Duplicates=" + no);
|
log.info("Duplicates=" + no);
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ public class ImportBankStatement extends SvrProcess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -508,18 +509,17 @@ public class ImportBankStatement extends SvrProcess
|
||||||
line = null;
|
line = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close database connection
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
rs = null;
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_BankStatement ")
|
sql = new StringBuilder ("UPDATE I_BankStatement ")
|
||||||
|
|
|
@ -236,10 +236,11 @@ public class ImportConversionRate extends SvrProcess
|
||||||
.append("WHERE I_IsImported='N'").append (clientCheck)
|
.append("WHERE I_IsImported='N'").append (clientCheck)
|
||||||
.append(" ORDER BY C_Currency_ID, C_Currency_ID_To, ValidFrom");
|
.append(" ORDER BY C_Currency_ID, C_Currency_ID_To, ValidFrom");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
X_I_Conversion_Rate imp = new X_I_Conversion_Rate (getCtx(), rs, get_TrxName());
|
X_I_Conversion_Rate imp = new X_I_Conversion_Rate (getCtx(), rs, get_TrxName());
|
||||||
|
@ -270,22 +271,15 @@ public class ImportConversionRate extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -588,10 +588,11 @@ public class ImportGLJournal extends SvrProcess
|
||||||
.append("FROM I_GLJournal ")
|
.append("FROM I_GLJournal ")
|
||||||
.append("WHERE I_IsImported='N'").append (clientCheck);
|
.append("WHERE I_IsImported='N'").append (clientCheck);
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
BigDecimal source = rs.getBigDecimal(1);
|
BigDecimal source = rs.getBigDecimal(1);
|
||||||
|
@ -608,23 +609,17 @@ public class ImportGLJournal extends SvrProcess
|
||||||
if (acct != null)
|
if (acct != null)
|
||||||
addLog (0, null, acct, "@AmtAcctDr@ - @AmtAcctCr@");
|
addLog (0, null, acct, "@AmtAcctDr@ - @AmtAcctCr@");
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), ex);
|
log.log(Level.SEVERE, sql.toString(), ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
// globalqss (moved the commit here to save the error messages)
|
// globalqss (moved the commit here to save the error messages)
|
||||||
commitEx();
|
commitEx();
|
||||||
|
@ -669,7 +664,7 @@ public class ImportGLJournal extends SvrProcess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
//
|
//
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -831,23 +826,18 @@ public class ImportGLJournal extends SvrProcess
|
||||||
noInsertLine++;
|
noInsertLine++;
|
||||||
}
|
}
|
||||||
} // while records
|
} // while records
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "", e);
|
log.log(Level.SEVERE, "", e);
|
||||||
}
|
}
|
||||||
// clean up
|
// clean up
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_GLJournal ")
|
sql = new StringBuilder ("UPDATE I_GLJournal ")
|
||||||
|
|
|
@ -139,6 +139,7 @@ public class ImportInOutConfirm extends SvrProcess
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
sql = new StringBuilder ("SELECT * FROM I_InOutLineConfirm ")
|
sql = new StringBuilder ("SELECT * FROM I_InOutLineConfirm ")
|
||||||
.append("WHERE I_IsImported='N'").append (clientCheck)
|
.append("WHERE I_IsImported='N'").append (clientCheck)
|
||||||
.append(" ORDER BY I_InOutLineConfirm_ID");
|
.append(" ORDER BY I_InOutLineConfirm_ID");
|
||||||
|
@ -146,7 +147,7 @@ public class ImportInOutConfirm extends SvrProcess
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
X_I_InOutLineConfirm importLine = new X_I_InOutLineConfirm (getCtx(), rs, get_TrxName());
|
X_I_InOutLineConfirm importLine = new X_I_InOutLineConfirm (getCtx(), rs, get_TrxName());
|
||||||
|
@ -176,22 +177,15 @@ public class ImportInOutConfirm extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
|
StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
|
||||||
|
|
|
@ -227,7 +227,6 @@ public class ImportInventory extends SvrProcess
|
||||||
if (no != 0)
|
if (no != 0)
|
||||||
log.warning ("No Location=" + no);
|
log.warning ("No Location=" + no);
|
||||||
|
|
||||||
|
|
||||||
// Set M_Warehouse_ID
|
// Set M_Warehouse_ID
|
||||||
sql = new StringBuilder ("UPDATE I_Inventory i ")
|
sql = new StringBuilder ("UPDATE I_Inventory i ")
|
||||||
.append("SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Locator l WHERE i.M_Locator_ID=l.M_Locator_ID) ")
|
.append("SET M_Warehouse_ID=(SELECT M_Warehouse_ID FROM M_Locator l WHERE i.M_Locator_ID=l.M_Locator_ID) ")
|
||||||
|
@ -243,6 +242,14 @@ public class ImportInventory extends SvrProcess
|
||||||
if (no != 0)
|
if (no != 0)
|
||||||
log.warning ("No Warehouse=" + no);
|
log.warning ("No Warehouse=" + no);
|
||||||
|
|
||||||
|
// IDEMPIERE-590 do not allow locator/wh from different org
|
||||||
|
sql = new StringBuilder ("UPDATE I_Inventory ")
|
||||||
|
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=Locator not from Org, ' ")
|
||||||
|
.append("WHERE AD_Org_ID <> (SELECT AD_Org_ID FROM M_Warehouse WHERE M_Warehouse_ID = I_Inventory.M_Warehouse_ID")
|
||||||
|
.append(" AND I_IsImported<>'Y'").append (clientCheck).append(" )");
|
||||||
|
no = DB.executeUpdate (sql.toString (), get_TrxName());
|
||||||
|
if (no != 0)
|
||||||
|
log.warning ("Locator not from Org=" + no);
|
||||||
|
|
||||||
// Product
|
// Product
|
||||||
sql = new StringBuilder ("UPDATE I_Inventory i ")
|
sql = new StringBuilder ("UPDATE I_Inventory i ")
|
||||||
|
|
|
@ -483,10 +483,12 @@ public class ImportInvoice extends SvrProcess
|
||||||
// Go through Invoice Records w/o C_BPartner_ID
|
// Go through Invoice Records w/o C_BPartner_ID
|
||||||
sql = new StringBuilder ("SELECT * FROM I_Invoice ")
|
sql = new StringBuilder ("SELECT * FROM I_Invoice ")
|
||||||
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
X_I_Invoice imp = new X_I_Invoice (getCtx(), rs, get_TrxName());
|
X_I_Invoice imp = new X_I_Invoice (getCtx(), rs, get_TrxName());
|
||||||
|
@ -593,14 +595,18 @@ public class ImportInvoice extends SvrProcess
|
||||||
}
|
}
|
||||||
imp.save ();
|
imp.save ();
|
||||||
} // for all new BPartners
|
} // for all new BPartners
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "CreateBP", e);
|
log.log(Level.SEVERE, "CreateBP", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
sql = new StringBuilder ("UPDATE I_Invoice ")
|
sql = new StringBuilder ("UPDATE I_Invoice ")
|
||||||
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
||||||
.append("WHERE C_BPartner_ID IS NULL")
|
.append("WHERE C_BPartner_ID IS NULL")
|
||||||
|
@ -622,8 +628,8 @@ public class ImportInvoice extends SvrProcess
|
||||||
.append(" ORDER BY C_BPartner_ID, C_BPartner_Location_ID, I_Invoice_ID");
|
.append(" ORDER BY C_BPartner_ID, C_BPartner_Location_ID, I_Invoice_ID");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
// Group Change
|
// Group Change
|
||||||
int oldC_BPartner_ID = 0;
|
int oldC_BPartner_ID = 0;
|
||||||
int oldC_BPartner_Location_ID = 0;
|
int oldC_BPartner_Location_ID = 0;
|
||||||
|
@ -751,13 +757,17 @@ public class ImportInvoice extends SvrProcess
|
||||||
}
|
}
|
||||||
invoice.saveEx();
|
invoice.saveEx();
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "CreateInvoice", e);
|
log.log(Level.SEVERE, "CreateInvoice", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_Invoice ")
|
sql = new StringBuilder ("UPDATE I_Invoice ")
|
||||||
|
|
|
@ -499,10 +499,12 @@ public class ImportOrder extends SvrProcess
|
||||||
// Go through Order Records w/o C_BPartner_ID
|
// Go through Order Records w/o C_BPartner_ID
|
||||||
sql = new StringBuilder ("SELECT * FROM I_Order ")
|
sql = new StringBuilder ("SELECT * FROM I_Order ")
|
||||||
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
X_I_Order imp = new X_I_Order (getCtx (), rs, get_TrxName());
|
X_I_Order imp = new X_I_Order (getCtx (), rs, get_TrxName());
|
||||||
|
@ -610,14 +612,18 @@ public class ImportOrder extends SvrProcess
|
||||||
}
|
}
|
||||||
imp.save ();
|
imp.save ();
|
||||||
} // for all new BPartners
|
} // for all new BPartners
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "BP - " + sql.toString(), e);
|
log.log(Level.SEVERE, "BP - " + sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
sql = new StringBuilder ("UPDATE I_Order ")
|
sql = new StringBuilder ("UPDATE I_Order ")
|
||||||
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
||||||
.append("WHERE C_BPartner_ID IS NULL")
|
.append("WHERE C_BPartner_ID IS NULL")
|
||||||
|
@ -639,8 +645,8 @@ public class ImportOrder extends SvrProcess
|
||||||
.append(" ORDER BY C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, I_Order_ID");
|
.append(" ORDER BY C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, I_Order_ID");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
//
|
//
|
||||||
int oldC_BPartner_ID = 0;
|
int oldC_BPartner_ID = 0;
|
||||||
int oldBillTo_ID = 0;
|
int oldBillTo_ID = 0;
|
||||||
|
@ -779,13 +785,17 @@ public class ImportOrder extends SvrProcess
|
||||||
}
|
}
|
||||||
order.saveEx();
|
order.saveEx();
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Order - " + sql.toString(), e);
|
log.log(Level.SEVERE, "Order - " + sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_Order ")
|
sql = new StringBuilder ("UPDATE I_Order ")
|
||||||
|
|
|
@ -413,11 +413,12 @@ public class ImportPayment extends SvrProcess
|
||||||
|
|
||||||
MBankAccount account = null;
|
MBankAccount account = null;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
int noInsert = 0;
|
int noInsert = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -512,18 +513,17 @@ public class ImportPayment extends SvrProcess
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close database connection
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
rs = null;
|
|
||||||
pstmt = null;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_Payment ")
|
sql = new StringBuilder ("UPDATE I_Payment ")
|
||||||
|
|
|
@ -385,20 +385,26 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
|
|
||||||
// Get Default Tax Category
|
// Get Default Tax Category
|
||||||
int C_TaxCategory_ID = 0;
|
int C_TaxCategory_ID = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuilder dbpst = new StringBuilder("SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'").append(clientCheck);
|
StringBuilder dbpst = new StringBuilder("SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'").append(clientCheck);
|
||||||
PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
C_TaxCategory_ID = rs.getInt(1);
|
C_TaxCategory_ID = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
throw new Exception ("TaxCategory", e);
|
throw new Exception ("TaxCategory", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
log.fine("C_TaxCategory_ID=" + C_TaxCategory_ID);
|
log.fine("C_TaxCategory_ID=" + C_TaxCategory_ID);
|
||||||
|
|
||||||
ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_AFTER_VALIDATE);
|
ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_AFTER_VALIDATE);
|
||||||
|
@ -415,6 +421,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
log.fine("start inserting/updating ...");
|
log.fine("start inserting/updating ...");
|
||||||
sql = new StringBuilder ("SELECT * FROM I_Product WHERE I_IsImported='N'")
|
sql = new StringBuilder ("SELECT * FROM I_Product WHERE I_IsImported='N'")
|
||||||
.append(clientCheck);
|
.append(clientCheck);
|
||||||
|
PreparedStatement pstmt_setImported = null;
|
||||||
|
PreparedStatement pstmt_insertProductPO = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
/* Insert Product from Import
|
/* Insert Product from Import
|
||||||
|
@ -468,7 +476,7 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
(sqlt, get_TrxName());
|
(sqlt, get_TrxName());
|
||||||
*/
|
*/
|
||||||
// Insert Product from Import
|
// Insert Product from Import
|
||||||
PreparedStatement pstmt_insertProductPO = DB.prepareStatement
|
pstmt_insertProductPO = DB.prepareStatement
|
||||||
("INSERT INTO M_Product_PO (M_Product_ID,C_BPartner_ID, "
|
("INSERT INTO M_Product_PO (M_Product_ID,C_BPartner_ID, "
|
||||||
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
|
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
|
||||||
+ "IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,"
|
+ "IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,"
|
||||||
|
@ -487,13 +495,13 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
+ "WHERE I_Product_ID=?", get_TrxName());
|
+ "WHERE I_Product_ID=?", get_TrxName());
|
||||||
|
|
||||||
// Set Imported = Y
|
// Set Imported = Y
|
||||||
PreparedStatement pstmt_setImported = DB.prepareStatement
|
pstmt_setImported = DB.prepareStatement
|
||||||
("UPDATE I_Product SET I_IsImported='Y', M_Product_ID=?, "
|
("UPDATE I_Product SET I_IsImported='Y', M_Product_ID=?, "
|
||||||
+ "Updated=SysDate, Processed='Y' WHERE I_Product_ID=?", get_TrxName());
|
+ "Updated=SysDate, Processed='Y' WHERE I_Product_ID=?", get_TrxName());
|
||||||
|
|
||||||
//
|
//
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
X_I_Product imp = new X_I_Product(getCtx(), rs, get_TrxName());
|
X_I_Product imp = new X_I_Product(getCtx(), rs, get_TrxName());
|
||||||
|
@ -558,7 +566,11 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
DB.executeUpdate(sql0.toString(), get_TrxName());
|
DB.executeUpdate(sql0.toString(), get_TrxName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pstmt_updateProduct.close();
|
finally
|
||||||
|
{
|
||||||
|
DB.close(pstmt_updateProduct);
|
||||||
|
pstmt_updateProduct = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we have PO Info
|
// Do we have PO Info
|
||||||
|
@ -604,7 +616,11 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
DB.executeUpdate(sql0.toString(), get_TrxName());
|
DB.executeUpdate(sql0.toString(), get_TrxName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pstmt_updateProductPO.close();
|
finally
|
||||||
|
{
|
||||||
|
DB.close(pstmt_updateProductPO);
|
||||||
|
pstmt_updateProductPO = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (no == 0) // Insert PO
|
if (no == 0) // Insert PO
|
||||||
{
|
{
|
||||||
|
@ -657,20 +673,19 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
||||||
//
|
//
|
||||||
commitEx();
|
commitEx();
|
||||||
} // for all I_Product
|
} // for all I_Product
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
|
|
||||||
//
|
|
||||||
// pstmt_insertProduct.close();
|
|
||||||
// pstmt_updateProduct.close();
|
|
||||||
pstmt_insertProductPO.close();
|
|
||||||
// pstmt_updateProductPO.close();
|
|
||||||
pstmt_setImported.close();
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;pstmt = null;
|
||||||
|
DB.close(pstmt_insertProductPO);
|
||||||
|
pstmt_insertProductPO = null;
|
||||||
|
DB.close(pstmt_setImported);
|
||||||
|
pstmt_setImported = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_Product ")
|
sql = new StringBuilder ("UPDATE I_Product ")
|
||||||
|
|
|
@ -265,6 +265,9 @@ public class ImportReportLine extends SvrProcess
|
||||||
.append("FROM I_ReportLine ")
|
.append("FROM I_ReportLine ")
|
||||||
.append("WHERE I_IsImported='N' AND PA_ReportLine_ID IS NULL")
|
.append("WHERE I_IsImported='N' AND PA_ReportLine_ID IS NULL")
|
||||||
.append(" AND I_IsImported='N'").append(clientCheck);
|
.append(" AND I_IsImported='N'").append(clientCheck);
|
||||||
|
PreparedStatement pstmt_insertLine = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Insert ReportLine
|
// Insert ReportLine
|
||||||
|
@ -283,10 +286,10 @@ public class ImportReportLine extends SvrProcess
|
||||||
.append("WHERE PA_ReportLineSet_ID=? AND Name=? ") // #2..3
|
.append("WHERE PA_ReportLineSet_ID=? AND Name=? ") // #2..3
|
||||||
//jz + clientCheck, get_TrxName());
|
//jz + clientCheck, get_TrxName());
|
||||||
.append(clientCheck).append(")");
|
.append(clientCheck).append(")");
|
||||||
PreparedStatement pstmt_insertLine = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
pstmt_insertLine = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||||
|
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int PA_ReportLineSet_ID = rs.getInt(1);
|
int PA_ReportLineSet_ID = rs.getInt(1);
|
||||||
|
@ -311,15 +314,18 @@ public class ImportReportLine extends SvrProcess
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
//
|
|
||||||
pstmt_insertLine.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Create ReportLine", e);
|
log.log(Level.SEVERE, "Create ReportLine", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;pstmt = null;
|
||||||
|
DB.close(pstmt_insertLine);
|
||||||
|
pstmt_insertLine = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set PA_ReportLine_ID (for newly created)
|
// Set PA_ReportLine_ID (for newly created)
|
||||||
sql = new StringBuilder ("UPDATE I_ReportLine i ")
|
sql = new StringBuilder ("UPDATE I_ReportLine i ")
|
||||||
|
@ -356,6 +362,9 @@ public class ImportReportLine extends SvrProcess
|
||||||
.append("WHERE PA_ReportLine_ID IS NOT NULL")
|
.append("WHERE PA_ReportLine_ID IS NOT NULL")
|
||||||
.append(" AND I_IsImported='N'").append(clientCheck);
|
.append(" AND I_IsImported='N'").append(clientCheck);
|
||||||
|
|
||||||
|
PreparedStatement pstmt_insertSource = null;
|
||||||
|
PreparedStatement pstmt_deleteSource = null;
|
||||||
|
PreparedStatement pstmt_setImported = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Insert ReportSource
|
// Insert ReportSource
|
||||||
|
@ -370,7 +379,7 @@ public class ImportReportLine extends SvrProcess
|
||||||
.append("WHERE I_ReportLine_ID=?")
|
.append("WHERE I_ReportLine_ID=?")
|
||||||
.append(" AND I_IsImported='N'")
|
.append(" AND I_IsImported='N'")
|
||||||
.append(clientCheck);
|
.append(clientCheck);
|
||||||
PreparedStatement pstmt_insertSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
pstmt_insertSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||||
|
|
||||||
// Update ReportSource
|
// Update ReportSource
|
||||||
//jz
|
//jz
|
||||||
|
@ -391,17 +400,17 @@ public class ImportReportLine extends SvrProcess
|
||||||
.append("WHERE C_ElementValue_ID IS NULL")
|
.append("WHERE C_ElementValue_ID IS NULL")
|
||||||
.append(" AND PA_ReportSource_ID=?")
|
.append(" AND PA_ReportSource_ID=?")
|
||||||
.append(clientCheck);
|
.append(clientCheck);
|
||||||
PreparedStatement pstmt_deleteSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
pstmt_deleteSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||||
//End afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports
|
//End afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports
|
||||||
|
|
||||||
// Set Imported = Y
|
// Set Imported = Y
|
||||||
PreparedStatement pstmt_setImported = DB.prepareStatement
|
pstmt_setImported = DB.prepareStatement
|
||||||
("UPDATE I_ReportLine SET I_IsImported='Y',"
|
("UPDATE I_ReportLine SET I_IsImported='Y',"
|
||||||
+ " PA_ReportSource_ID=?, "
|
+ " PA_ReportSource_ID=?, "
|
||||||
+ " Updated=SysDate, Processed='Y' WHERE I_ReportLine_ID=?", get_TrxName());
|
+ " Updated=SysDate, Processed='Y' WHERE I_ReportLine_ID=?", get_TrxName());
|
||||||
|
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int I_ReportLine_ID = rs.getInt(1);
|
int I_ReportLine_ID = rs.getInt(1);
|
||||||
|
@ -461,7 +470,11 @@ public class ImportReportLine extends SvrProcess
|
||||||
DB.executeUpdate(sql.toString(), get_TrxName());
|
DB.executeUpdate(sql.toString(), get_TrxName());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
pstmt_updateSource.close();
|
finally
|
||||||
|
{
|
||||||
|
DB.close(pstmt_updateSource);
|
||||||
|
pstmt_updateSource = null;
|
||||||
|
}
|
||||||
} // update source
|
} // update source
|
||||||
|
|
||||||
// Set Imported to Y
|
// Set Imported to Y
|
||||||
|
@ -481,17 +494,19 @@ public class ImportReportLine extends SvrProcess
|
||||||
|
|
||||||
commitEx();
|
commitEx();
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
//
|
|
||||||
pstmt_insertSource.close();
|
|
||||||
//jz pstmt_updateSource.close();
|
|
||||||
pstmt_setImported.close();
|
|
||||||
//
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;pstmt = null;
|
||||||
|
DB.close(pstmt_insertSource);
|
||||||
|
pstmt_insertSource = null;
|
||||||
|
DB.close(pstmt_setImported);
|
||||||
|
pstmt_setImported = null;
|
||||||
|
}
|
||||||
|
|
||||||
// Set Error to indicator to not imported
|
// Set Error to indicator to not imported
|
||||||
sql = new StringBuilder ("UPDATE I_ReportLine ")
|
sql = new StringBuilder ("UPDATE I_ReportLine ")
|
||||||
|
|
|
@ -209,9 +209,10 @@ public class InOutGenerate extends SvrProcess
|
||||||
private String generate (PreparedStatement pstmt)
|
private String generate (PreparedStatement pstmt)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ()) // Order
|
while (rs.next ()) // Order
|
||||||
{
|
{
|
||||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||||
|
@ -391,22 +392,15 @@ public class InOutGenerate extends SvrProcess
|
||||||
}
|
}
|
||||||
m_line += 1000;
|
m_line += 1000;
|
||||||
} // while order
|
} // while order
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, m_sql.toString(), e);
|
log.log(Level.SEVERE, m_sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
completeShipment();
|
completeShipment();
|
||||||
|
|
|
@ -200,6 +200,7 @@ public class InventoryCountCreate extends SvrProcess
|
||||||
//
|
//
|
||||||
int count = 0;
|
int count = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
|
@ -213,7 +214,7 @@ public class InventoryCountCreate extends SvrProcess
|
||||||
pstmt.setString(index++, p_ProductValue.toUpperCase());
|
pstmt.setString(index++, p_ProductValue.toUpperCase());
|
||||||
if (!p_DeleteOld)
|
if (!p_DeleteOld)
|
||||||
pstmt.setInt(index++, p_M_Inventory_ID);
|
pstmt.setInt(index++, p_M_Inventory_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int M_Product_ID = rs.getInt(1);
|
int M_Product_ID = rs.getInt(1);
|
||||||
|
@ -235,22 +236,15 @@ public class InventoryCountCreate extends SvrProcess
|
||||||
M_AttributeSetInstance_ID, QtyOnHand, M_AttributeSet_ID);
|
M_AttributeSetInstance_ID, QtyOnHand, M_AttributeSet_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,17 +348,28 @@ public class InventoryCountCreate extends SvrProcess
|
||||||
StringBuilder retString = new StringBuilder();
|
StringBuilder retString = new StringBuilder();
|
||||||
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
|
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
|
||||||
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
|
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
|
||||||
Statement stmt = DB.createStatement();
|
Statement stmt = null;
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
ResultSet rs = null;
|
||||||
while (rs.next()) {
|
try
|
||||||
if(rs.getInt(1)==productCategoryId) {
|
{
|
||||||
subTreeRootParentId = rs.getInt(2);
|
stmt = DB.createStatement();
|
||||||
|
rs = stmt.executeQuery(sql);
|
||||||
|
while (rs.next()) {
|
||||||
|
if(rs.getInt(1)==productCategoryId) {
|
||||||
|
subTreeRootParentId = rs.getInt(2);
|
||||||
|
}
|
||||||
|
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
|
||||||
}
|
}
|
||||||
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
|
retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
|
||||||
|
} catch (SQLException e)
|
||||||
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null;stmt = null;
|
||||||
}
|
}
|
||||||
retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
|
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
return retString.toString();
|
return retString.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,11 +136,12 @@ public class InventoryCountUpdate extends SvrProcess
|
||||||
//
|
//
|
||||||
String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? AND M_AttributeSetInstance_ID=0";
|
String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? AND M_AttributeSetInstance_ID=0";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, p_M_Inventory_ID);
|
pstmt.setInt (1, p_M_Inventory_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MInventoryLine il = new MInventoryLine (getCtx(), rs, get_TrxName());
|
MInventoryLine il = new MInventoryLine (getCtx(), rs, get_TrxName());
|
||||||
|
@ -168,22 +169,15 @@ public class InventoryCountUpdate extends SvrProcess
|
||||||
if (il.save())
|
if (il.save())
|
||||||
no++;
|
no++;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -191,9 +191,10 @@ public class InvoiceGenerate extends SvrProcess
|
||||||
*/
|
*/
|
||||||
private String generate (PreparedStatement pstmt)
|
private String generate (PreparedStatement pstmt)
|
||||||
{
|
{
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||||
|
@ -320,22 +321,15 @@ public class InvoiceGenerate extends SvrProcess
|
||||||
}
|
}
|
||||||
} // complete Order
|
} // complete Order
|
||||||
} // for all orders
|
} // for all orders
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "", e);
|
log.log(Level.SEVERE, "", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
completeInvoice();
|
completeInvoice();
|
||||||
|
|
|
@ -170,32 +170,26 @@ public class InvoiceWriteOff extends SvrProcess
|
||||||
//
|
//
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
if (writeOff(rs.getInt(1), rs.getString(2), rs.getTimestamp(3),
|
if (writeOff(rs.getInt(1), rs.getString(2), rs.getTimestamp(3),
|
||||||
rs.getInt(4), rs.getBigDecimal(6)))
|
rs.getInt(4), rs.getBigDecimal(6)))
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// final
|
// final
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -110,20 +110,26 @@ public class M_Product_BOM_Check extends SvrProcess
|
||||||
|
|
||||||
// Get count remaining on t_selection
|
// Get count remaining on t_selection
|
||||||
int countno = 0;
|
int countno = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
StringBuilder dbpst = new StringBuilder("SELECT COUNT(*) FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
|
StringBuilder dbpst = new StringBuilder("SELECT COUNT(*) FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
|
||||||
PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
countno = rs.getInt(1);
|
countno = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
throw new Exception ("count t_selection", e);
|
throw new Exception ("count t_selection", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
log.fine("Count T_Selection =" + countno);
|
log.fine("Count T_Selection =" + countno);
|
||||||
|
|
||||||
if (countno == 0)
|
if (countno == 0)
|
||||||
|
|
|
@ -128,12 +128,13 @@ public class OrderBatchProcess extends SvrProcess
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int errCounter = 0;
|
int errCounter = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
pstmt.setInt(1, p_C_DocTypeTarget_ID);
|
pstmt.setInt(1, p_C_DocTypeTarget_ID);
|
||||||
pstmt.setString(2, p_DocStatus);
|
pstmt.setString(2, p_DocStatus);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
if (process(new MOrder(getCtx(),rs, get_TrxName())))
|
if (process(new MOrder(getCtx(),rs, get_TrxName())))
|
||||||
|
@ -141,22 +142,15 @@ public class OrderBatchProcess extends SvrProcess
|
||||||
else
|
else
|
||||||
errCounter++;
|
errCounter++;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
StringBuilder msgreturn = new StringBuilder("@Updated@=").append(counter).append(", @Errors@=").append(errCounter);
|
StringBuilder msgreturn = new StringBuilder("@Updated@=").append(counter).append(", @Errors@=").append(errCounter);
|
||||||
|
|
|
@ -183,7 +183,8 @@ public class PaySelectionCreateFrom extends SvrProcess
|
||||||
//
|
//
|
||||||
int lines = 0;
|
int lines = 0;
|
||||||
int C_CurrencyTo_ID = psel.getC_Currency_ID();
|
int C_CurrencyTo_ID = psel.getC_Currency_ID();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
|
@ -207,7 +208,7 @@ public class PaySelectionCreateFrom extends SvrProcess
|
||||||
else if (p_C_BP_Group_ID != 0)
|
else if (p_C_BP_Group_ID != 0)
|
||||||
pstmt.setInt (index++, p_C_BP_Group_ID);
|
pstmt.setInt (index++, p_C_BP_Group_ID);
|
||||||
//
|
//
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int C_Invoice_ID = rs.getInt(1);
|
int C_Invoice_ID = rs.getInt(1);
|
||||||
|
@ -228,23 +229,16 @@ public class PaySelectionCreateFrom extends SvrProcess
|
||||||
throw new IllegalStateException ("Cannot save MPaySelectionLine");
|
throw new IllegalStateException ("Cannot save MPaySelectionLine");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
StringBuilder msgreturn = new StringBuilder("@C_PaySelectionLine_ID@ - #").append(lines);
|
StringBuilder msgreturn = new StringBuilder("@C_PaySelectionLine_ID@ - #").append(lines);
|
||||||
return msgreturn.toString();
|
return msgreturn.toString();
|
||||||
|
|
|
@ -737,29 +737,23 @@ public class ReplenishReport extends SvrProcess
|
||||||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
pstmt.setInt (1, getAD_PInstance_ID());
|
pstmt.setInt (1, getAD_PInstance_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||||
|
@ -780,29 +774,23 @@ public class ReplenishReport extends SvrProcess
|
||||||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
pstmt.setInt (1, getAD_PInstance_ID());
|
pstmt.setInt (1, getAD_PInstance_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||||
|
|
|
@ -838,29 +838,23 @@ public class ReplenishReportProduction extends SvrProcess
|
||||||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
pstmt.setInt (1, getAD_PInstance_ID());
|
pstmt.setInt (1, getAD_PInstance_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||||
|
|
|
@ -227,14 +227,17 @@ public class ReplicationLocal extends SvrProcess
|
||||||
{
|
{
|
||||||
while (rowset.next())
|
while (rowset.next())
|
||||||
mergeDataTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
mergeDataTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
||||||
rowset.close();
|
|
||||||
rowset = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "mergeData", ex);
|
log.log(Level.SEVERE, "mergeData", ex);
|
||||||
m_replicated = false;
|
m_replicated = false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rowset);
|
||||||
|
rowset = null;
|
||||||
|
}
|
||||||
} // mergeData
|
} // mergeData
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -318,9 +321,9 @@ public class ReplicationLocal extends SvrProcess
|
||||||
rLog.setIsReplicated(replicated);
|
rLog.setIsReplicated(replicated);
|
||||||
if (result != null)
|
if (result != null)
|
||||||
rLog.setP_Msg("< " + result.toString());
|
rLog.setP_Msg("< " + result.toString());
|
||||||
sourceRS.close();
|
DB.close(sourceRS);
|
||||||
sourceRS = null;
|
sourceRS = null;
|
||||||
targetRS.close();
|
DB.close(targetRS);
|
||||||
targetRS = null;
|
targetRS = null;
|
||||||
}
|
}
|
||||||
rLog.saveEx();
|
rLog.saveEx();
|
||||||
|
@ -336,6 +339,7 @@ public class ReplicationLocal extends SvrProcess
|
||||||
{
|
{
|
||||||
ArrayList<String> list = new ArrayList<String>();
|
ArrayList<String> list = new ArrayList<String>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Get Keys
|
// Get Keys
|
||||||
|
@ -344,14 +348,14 @@ public class ReplicationLocal extends SvrProcess
|
||||||
+ " AND IsKey='Y'";
|
+ " AND IsKey='Y'";
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, AD_Table_ID);
|
pstmt.setInt(1, AD_Table_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(rs.getString(1));
|
list.add(rs.getString(1));
|
||||||
rs.close();
|
|
||||||
|
|
||||||
// no keys - search for parents
|
// no keys - search for parents
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
{
|
{
|
||||||
|
DB.close(rs);
|
||||||
|
rs = null;
|
||||||
sql = "SELECT ColumnName FROM AD_Column "
|
sql = "SELECT ColumnName FROM AD_Column "
|
||||||
+ "WHERE AD_Table_ID=?"
|
+ "WHERE AD_Table_ID=?"
|
||||||
+ " AND IsParent='Y'";
|
+ " AND IsParent='Y'";
|
||||||
|
@ -360,22 +364,17 @@ public class ReplicationLocal extends SvrProcess
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(rs.getString(1));
|
list.add(rs.getString(1));
|
||||||
rs.close();
|
|
||||||
}
|
}
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "getKeyColumns", e);
|
log.log(Level.SEVERE, "getKeyColumns", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert to Array
|
// Convert to Array
|
||||||
|
@ -406,13 +405,17 @@ public class ReplicationLocal extends SvrProcess
|
||||||
{
|
{
|
||||||
while (rowset.next())
|
while (rowset.next())
|
||||||
sendUpdatesTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
sendUpdatesTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
||||||
rowset.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "sendUpdates", ex);
|
log.log(Level.SEVERE, "sendUpdates", ex);
|
||||||
m_replicated = false;
|
m_replicated = false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rowset);
|
||||||
|
rowset = null;
|
||||||
|
}
|
||||||
} // sendUpdates
|
} // sendUpdates
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -534,6 +537,7 @@ public class ReplicationLocal extends SvrProcess
|
||||||
Connection conn = DB.getConnectionRO();
|
Connection conn = DB.getConnectionRO();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
RowSet rowSet = null;
|
RowSet rowSet = null;
|
||||||
|
ResultSet rs = null;
|
||||||
//
|
//
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -557,7 +561,7 @@ public class ReplicationLocal extends SvrProcess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
rowSet = CCachedRowSet.getRowSet(rs);
|
rowSet = CCachedRowSet.getRowSet(rs);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -568,8 +572,8 @@ public class ReplicationLocal extends SvrProcess
|
||||||
// Close Cursor
|
// Close Cursor
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
DB.close(pstmt);
|
DB.close(rs,pstmt);
|
||||||
pstmt = null;
|
rs = null;pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rowSet;
|
return rowSet;
|
||||||
|
|
|
@ -352,16 +352,25 @@ public class RequestEMailProcessor extends SvrProcess
|
||||||
+ "and documentno = ? "
|
+ "and documentno = ? "
|
||||||
+ "and startdate = ?";
|
+ "and startdate = ?";
|
||||||
PreparedStatement pstmtdup = null;
|
PreparedStatement pstmtdup = null;
|
||||||
|
ResultSet rsdup = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
pstmtdup = DB.prepareStatement (sqldup, null);
|
pstmtdup = DB.prepareStatement (sqldup, null);
|
||||||
pstmtdup.setInt(1, getAD_Client_ID());
|
pstmtdup.setInt(1, getAD_Client_ID());
|
||||||
pstmtdup.setString(2, hdrs[0].substring(0,30));
|
pstmtdup.setString(2, hdrs[0].substring(0,30));
|
||||||
pstmtdup.setTimestamp(3, new Timestamp(msg.getSentDate().getTime()));
|
pstmtdup.setTimestamp(3, new Timestamp(msg.getSentDate().getTime()));
|
||||||
ResultSet rsdup = pstmtdup.executeQuery ();
|
rsdup = pstmtdup.executeQuery ();
|
||||||
if (rsdup.next ())
|
if (rsdup.next ())
|
||||||
retValuedup = rsdup.getInt(1);
|
retValuedup = rsdup.getInt(1);
|
||||||
rsdup.close ();
|
} catch (SQLException e)
|
||||||
pstmtdup.close ();
|
{
|
||||||
pstmtdup = null;
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close (rsdup,pstmtdup);
|
||||||
|
rsdup = null;pstmtdup = null;
|
||||||
|
}
|
||||||
if (retValuedup > 0) {
|
if (retValuedup > 0) {
|
||||||
log.info("request already existed for msg -> " + hdrs[0]);
|
log.info("request already existed for msg -> " + hdrs[0]);
|
||||||
return true;
|
return true;
|
||||||
|
@ -390,6 +399,9 @@ public class RequestEMailProcessor extends SvrProcess
|
||||||
+ " ) "
|
+ " ) "
|
||||||
+ " ) ";
|
+ " ) ";
|
||||||
PreparedStatement pstmtupd = null;
|
PreparedStatement pstmtupd = null;
|
||||||
|
ResultSet rsupd = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
pstmtupd = DB.prepareStatement (sqlupd, null);
|
pstmtupd = DB.prepareStatement (sqlupd, null);
|
||||||
pstmtupd.setInt(1, getAD_Client_ID());
|
pstmtupd.setInt(1, getAD_Client_ID());
|
||||||
pstmtupd.setString(2, fromAddress);
|
pstmtupd.setString(2, fromAddress);
|
||||||
|
@ -398,12 +410,19 @@ public class RequestEMailProcessor extends SvrProcess
|
||||||
pstmtupd.setString(5, msg.getSubject());
|
pstmtupd.setString(5, msg.getSubject());
|
||||||
pstmtupd.setString(6, fromAddress);
|
pstmtupd.setString(6, fromAddress);
|
||||||
pstmtupd.setString(7, msg.getSubject());
|
pstmtupd.setString(7, msg.getSubject());
|
||||||
ResultSet rsupd = pstmtupd.executeQuery ();
|
rsupd = pstmtupd.executeQuery ();
|
||||||
if (rsupd.next ())
|
if (rsupd.next ())
|
||||||
request_upd = rsupd.getInt(1);
|
request_upd = rsupd.getInt(1);
|
||||||
rsupd.close ();
|
}
|
||||||
pstmtupd.close ();
|
catch (SQLException e)
|
||||||
pstmtupd = null;
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rsupd,pstmtupd);
|
||||||
|
rsupd = null;pstmtupd = null;
|
||||||
|
}
|
||||||
if (request_upd > 0) {
|
if (request_upd > 0) {
|
||||||
log.info("msg -> " + hdrs[0] + " is an answer for req " + request_upd);
|
log.info("msg -> " + hdrs[0] + " is an answer for req " + request_upd);
|
||||||
return updateRequest(request_upd, msg);
|
return updateRequest(request_upd, msg);
|
||||||
|
@ -443,15 +462,25 @@ public class RequestEMailProcessor extends SvrProcess
|
||||||
+ " WHERE UPPER (email) = UPPER (?) "
|
+ " WHERE UPPER (email) = UPPER (?) "
|
||||||
+ " AND ad_client_id = ?";
|
+ " AND ad_client_id = ?";
|
||||||
PreparedStatement pstmtu = null;
|
PreparedStatement pstmtu = null;
|
||||||
|
ResultSet rsu = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
pstmtu = DB.prepareStatement (sqlu, null);
|
pstmtu = DB.prepareStatement (sqlu, null);
|
||||||
pstmtu.setString(1, fromAddress);
|
pstmtu.setString(1, fromAddress);
|
||||||
pstmtu.setInt(2, getAD_Client_ID());
|
pstmtu.setInt(2, getAD_Client_ID());
|
||||||
ResultSet rsu = pstmtu.executeQuery ();
|
rsu = pstmtu.executeQuery ();
|
||||||
if (rsu.next ())
|
if (rsu.next ())
|
||||||
retValueu = rsu.getInt(1);
|
retValueu = rsu.getInt(1);
|
||||||
rsu.close ();
|
}
|
||||||
pstmtu.close ();
|
catch(SQLException e)
|
||||||
pstmtu = null;
|
{
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close (rsu,pstmtu);
|
||||||
|
rsu = null;pstmtu = null;
|
||||||
|
}
|
||||||
if (retValueu > 0) {
|
if (retValueu > 0) {
|
||||||
req.setAD_User_ID(retValueu);
|
req.setAD_User_ID(retValueu);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,6 +116,7 @@ public class RequestInvoice extends SvrProcess
|
||||||
.append("ORDER BY C_BPartner_ID");
|
.append("ORDER BY C_BPartner_ID");
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||||
|
@ -127,7 +128,7 @@ public class RequestInvoice extends SvrProcess
|
||||||
pstmt.setInt (index++, p_R_Category_ID);
|
pstmt.setInt (index++, p_R_Category_ID);
|
||||||
if (p_C_BPartner_ID != 0)
|
if (p_C_BPartner_ID != 0)
|
||||||
pstmt.setInt (index++, p_C_BPartner_ID);
|
pstmt.setInt (index++, p_C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
int oldC_BPartner_ID = 0;
|
int oldC_BPartner_ID = 0;
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
|
@ -145,22 +146,15 @@ public class RequestInvoice extends SvrProcess
|
||||||
}
|
}
|
||||||
invoiceDone();
|
invoiceDone();
|
||||||
//
|
//
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql.toString(), e);
|
log.log (Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// R_Category_ID
|
// R_Category_ID
|
||||||
|
|
|
@ -167,11 +167,12 @@ public class SendMailText extends SvrProcess
|
||||||
+ " AND u.EMail IS NOT NULL"
|
+ " AND u.EMail IS NOT NULL"
|
||||||
+ " AND ci.R_InterestArea_ID=?";
|
+ " AND ci.R_InterestArea_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, m_R_InterestArea_ID);
|
pstmt.setInt(1, m_R_InterestArea_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), unsubscribe);
|
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), unsubscribe);
|
||||||
|
@ -182,24 +183,18 @@ public class SendMailText extends SvrProcess
|
||||||
else
|
else
|
||||||
m_errors++;
|
m_errors++;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, ex);
|
log.log(Level.SEVERE, sql, ex);
|
||||||
}
|
}
|
||||||
// Clean Up
|
// Clean Up
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
m_ia = null;
|
m_ia = null;
|
||||||
} // sendInterestArea
|
} // sendInterestArea
|
||||||
|
|
||||||
|
@ -217,11 +212,12 @@ public class SendMailText extends SvrProcess
|
||||||
+ " AND u.EMail IS NOT NULL"
|
+ " AND u.EMail IS NOT NULL"
|
||||||
+ " AND bp.C_BP_Group_ID=?";
|
+ " AND bp.C_BP_Group_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, m_C_BP_Group_ID);
|
pstmt.setInt(1, m_C_BP_Group_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), null);
|
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), null);
|
||||||
|
@ -232,24 +228,18 @@ public class SendMailText extends SvrProcess
|
||||||
else
|
else
|
||||||
m_errors++;
|
m_errors++;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, ex);
|
log.log(Level.SEVERE, sql, ex);
|
||||||
}
|
}
|
||||||
// Clean Up
|
// Clean Up
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
} // sendBPGroup
|
} // sendBPGroup
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -51,6 +51,8 @@ public class SynchronizeTerminology extends SvrProcess
|
||||||
{
|
{
|
||||||
//TODO Error handling
|
//TODO Error handling
|
||||||
String sql = null;
|
String sql = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
int no;
|
int no;
|
||||||
Trx trx = Trx.get(get_TrxName(), false);
|
Trx trx = Trx.get(get_TrxName(), false);
|
||||||
|
@ -60,8 +62,8 @@ public class SynchronizeTerminology extends SvrProcess
|
||||||
+"(SELECT 1 FROM AD_ELEMENT e "
|
+"(SELECT 1 FROM AD_ELEMENT e "
|
||||||
+" WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName))"
|
+" WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName))"
|
||||||
+" AND c.isActive = 'Y'";
|
+" AND c.isActive = 'Y'";
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next()){
|
while (rs.next()){
|
||||||
String columnName = rs.getString(1);
|
String columnName = rs.getString(1);
|
||||||
String name = rs.getString(2);
|
String name = rs.getString(2);
|
||||||
|
@ -74,8 +76,8 @@ public class SynchronizeTerminology extends SvrProcess
|
||||||
elem.setPrintName(name);
|
elem.setPrintName(name);
|
||||||
elem.saveEx();
|
elem.saveEx();
|
||||||
}
|
}
|
||||||
pstmt.close();
|
DB.close(rs, pstmt);
|
||||||
rs.close();
|
rs = null; pstmt = null;
|
||||||
trx.commit(true);
|
trx.commit(true);
|
||||||
// Create Elements for Process Parameters which are centrally maintained
|
// Create Elements for Process Parameters which are centrally maintained
|
||||||
/* IDEMPIERE 109 - this create unwanted Element
|
/* IDEMPIERE 109 - this create unwanted Element
|
||||||
|
@ -844,6 +846,12 @@ public class SynchronizeTerminology extends SvrProcess
|
||||||
log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e);
|
log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
return "@OK@";
|
return "@OK@";
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,10 +130,11 @@ public class TreeMaintenance extends SvrProcess
|
||||||
//
|
//
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int Node_ID = rs.getInt(1);
|
int Node_ID = rs.getInt(1);
|
||||||
|
@ -157,23 +158,16 @@ public class TreeMaintenance extends SvrProcess
|
||||||
log.log(Level.SEVERE, "Could not add to " + tree + " Node_ID=" + Node_ID);
|
log.log(Level.SEVERE, "Could not add to " + tree + " Node_ID=" + Node_ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "verifyTree", e);
|
log.log(Level.SEVERE, "verifyTree", e);
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
StringBuilder msglog = new StringBuilder().append(tree.getName()).append(" Inserted");
|
StringBuilder msglog = new StringBuilder().append(tree.getName()).append(" Inserted");
|
||||||
|
|
|
@ -118,23 +118,29 @@ public final class ImpFormat
|
||||||
String sql = "SELECT t.TableName,c.ColumnName "
|
String sql = "SELECT t.TableName,c.ColumnName "
|
||||||
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID AND c.IsKey='Y') "
|
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID AND c.IsKey='Y') "
|
||||||
+ "WHERE t.AD_Table_ID=?";
|
+ "WHERE t.AD_Table_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Table_ID);
|
pstmt.setInt(1, AD_Table_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_tableName = rs.getString(1);
|
m_tableName = rs.getString(1);
|
||||||
m_tablePK = rs.getString(2);
|
m_tablePK = rs.getString(2);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "ImpFormat.setTable", e);
|
log.log(Level.SEVERE, "ImpFormat.setTable", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
if (m_tableName == null || m_tablePK == null)
|
if (m_tableName == null || m_tablePK == null)
|
||||||
log.log(Level.SEVERE, "Data not found for AD_Table_ID=" + AD_Table_ID);
|
log.log(Level.SEVERE, "Data not found for AD_Table_ID=" + AD_Table_ID);
|
||||||
|
|
||||||
|
@ -269,11 +275,13 @@ public final class ImpFormat
|
||||||
ImpFormat retValue = null;
|
ImpFormat retValue = null;
|
||||||
String sql = "SELECT * FROM AD_ImpFormat WHERE Name=?";
|
String sql = "SELECT * FROM AD_ImpFormat WHERE Name=?";
|
||||||
int ID = 0;
|
int ID = 0;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString (1, name);
|
pstmt.setString (1, name);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
retValue = new ImpFormat (name, rs.getInt("AD_Table_ID"), rs.getString("FormatType"));
|
retValue = new ImpFormat (name, rs.getInt("AD_Table_ID"), rs.getString("FormatType"));
|
||||||
|
@ -282,14 +290,18 @@ public final class ImpFormat
|
||||||
retValue.setSeparatorChar(rs.getString(I_AD_ImpFormat.COLUMNNAME_SeparatorChar));
|
retValue.setSeparatorChar(rs.getString(I_AD_ImpFormat.COLUMNNAME_SeparatorChar));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
loadRows (retValue, ID);
|
loadRows (retValue, ID);
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getFormat
|
} // getFormat
|
||||||
|
@ -306,11 +318,13 @@ public final class ImpFormat
|
||||||
+ "FROM AD_ImpFormat_Row f,AD_Column c "
|
+ "FROM AD_ImpFormat_Row f,AD_Column c "
|
||||||
+ "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y'"
|
+ "WHERE f.AD_ImpFormat_ID=? AND f.AD_Column_ID=c.AD_Column_ID AND f.IsActive='Y'"
|
||||||
+ "ORDER BY f.SeqNo";
|
+ "ORDER BY f.SeqNo";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt (1, ID);
|
pstmt.setInt (1, ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
ImpFormatRow row = new ImpFormatRow (rs.getInt(1),
|
ImpFormatRow row = new ImpFormatRow (rs.getInt(1),
|
||||||
|
@ -322,13 +336,17 @@ public final class ImpFormat
|
||||||
//
|
//
|
||||||
format.addRow (row);
|
format.addRow (row);
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
} // loadLines
|
} // loadLines
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
|
@ -560,28 +578,33 @@ public final class ImpFormat
|
||||||
sql.append(find).append(")");
|
sql.append(find).append(")");
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int ID = 0;
|
int ID = 0;
|
||||||
try
|
if (find.length() > 0)
|
||||||
{
|
{
|
||||||
if (find.length() > 0)
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), trxName);
|
pstmt = DB.prepareStatement(sql.toString(), trxName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
count = rs.getInt(1);
|
count = rs.getInt(1);
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
ID = rs.getInt(2);
|
ID = rs.getInt(2);
|
||||||
}
|
}
|
||||||
rs.close();
|
}
|
||||||
pstmt.close();
|
catch (SQLException e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql.toString(), e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
|
||||||
{
|
|
||||||
log.log(Level.SEVERE, sql.toString(), e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Insert Basic Record -----------------------------------------------
|
// Insert Basic Record -----------------------------------------------
|
||||||
if (ID == 0)
|
if (ID == 0)
|
||||||
|
|
|
@ -73,29 +73,23 @@ public class MImpFormat extends X_AD_ImpFormat
|
||||||
+ "WHERE AD_ImpFormat_ID=? "
|
+ "WHERE AD_ImpFormat_ID=? "
|
||||||
+ "ORDER BY SeqNo";
|
+ "ORDER BY SeqNo";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getAD_ImpFormat_ID());
|
pstmt.setInt (1, getAD_ImpFormat_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MImpFormatRow (getCtx(), rs, get_TrxName()));
|
list.add(new MImpFormatRow (getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "getRows", e);
|
log.log(Level.SEVERE, "getRows", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MImpFormatRow[] retValue = new MImpFormatRow[list.size ()];
|
MImpFormatRow[] retValue = new MImpFormatRow[list.size ()];
|
||||||
|
|
|
@ -581,21 +581,27 @@ public class GridField
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement stmt = DB.prepareStatement(sql, null);
|
stmt = DB.prepareStatement(sql, null);
|
||||||
ResultSet rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
defStr = rs.getString(1);
|
defStr = rs.getString(1);
|
||||||
else
|
else
|
||||||
log.log(Level.WARNING, "(" + m_vo.ColumnName + ") - no Result: " + sql);
|
log.log(Level.WARNING, "(" + m_vo.ColumnName + ") - no Result: " + sql);
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.WARNING, "(" + m_vo.ColumnName + ") " + sql, e);
|
log.log(Level.WARNING, "(" + m_vo.ColumnName + ") " + sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null;
|
||||||
|
stmt = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (defStr != null && defStr.length() > 0)
|
if (defStr != null && defStr.length() > 0)
|
||||||
{
|
{
|
||||||
|
@ -1721,33 +1727,27 @@ public class GridField
|
||||||
|
|
||||||
String sql = GridFieldVO.getSQL(ctx);
|
String sql = GridFieldVO.getSQL(ctx);
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Tab_ID);
|
pstmt.setInt(1, AD_Tab_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
GridFieldVO vo = GridFieldVO.create(ctx, WindowNo, TabNo,
|
GridFieldVO vo = GridFieldVO.create(ctx, WindowNo, TabNo,
|
||||||
AD_Window_ID, AD_Tab_ID, readOnly, rs);
|
AD_Window_ID, AD_Tab_ID, readOnly, rs);
|
||||||
listVO.add(vo);
|
listVO.add(vo);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -794,21 +794,27 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
+ " INNER JOIN AD_Column cc ON (r.AD_Key=cc.AD_Column_ID) "
|
+ " INNER JOIN AD_Column cc ON (r.AD_Key=cc.AD_Column_ID) "
|
||||||
+ "WHERE c.AD_Reference_ID IN (18,30)" // Table/Search
|
+ "WHERE c.AD_Reference_ID IN (18,30)" // Table/Search
|
||||||
+ " AND c.ColumnName=?";
|
+ " AND c.ColumnName=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, colName);
|
pstmt.setString(1, colName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
refColName = rs.getString(1);
|
refColName = rs.getString(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "(ref) - Column=" + colName, e);
|
log.log(Level.SEVERE, "(ref) - Column=" + colName, e);
|
||||||
return query.getWhereClause();
|
return query.getWhereClause();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
// Reference Column found
|
// Reference Column found
|
||||||
if (refColName != null)
|
if (refColName != null)
|
||||||
{
|
{
|
||||||
|
@ -834,21 +840,24 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
+ " WHERE cc.AD_Table_ID=t.AD_Table_ID AND cc.ColumnName=?)"; // #2 Tab Key Column
|
+ " WHERE cc.AD_Table_ID=t.AD_Table_ID AND cc.ColumnName=?)"; // #2 Tab Key Column
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, colName);
|
pstmt.setString(1, colName);
|
||||||
pstmt.setString(2, tabKeyColumn);
|
pstmt.setString(2, tabKeyColumn);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
tableName = rs.getString(1);
|
tableName = rs.getString(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Column=" + colName + ", Key=" + tabKeyColumn, e);
|
log.log(Level.SEVERE, "Column=" + colName + ", Key=" + tabKeyColumn, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
// Special Reference Handling
|
// Special Reference Handling
|
||||||
if (tabKeyColumn.equals("AD_Reference_ID"))
|
if (tabKeyColumn.equals("AD_Reference_ID"))
|
||||||
{
|
{
|
||||||
|
@ -1290,20 +1299,26 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
String SQL = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
String SQL = "SELECT ColumnName FROM AD_Column WHERE AD_Column_ID=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
pstmt = DB.prepareStatement(SQL, null);
|
||||||
pstmt.setInt(1, m_vo.AD_Column_ID); // Parent Link Column
|
pstmt.setInt(1, m_vo.AD_Column_ID); // Parent Link Column
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
m_linkColumnName = rs.getString(1);
|
m_linkColumnName = rs.getString(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "", e);
|
log.log(Level.SEVERE, "", e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
log.fine("AD_Column_ID=" + m_vo.AD_Column_ID + " - " + m_linkColumnName);
|
log.fine("AD_Column_ID=" + m_vo.AD_Column_ID + " - " + m_linkColumnName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1759,11 +1774,13 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
+ "FROM C_InvoiceBatchLine "
|
+ "FROM C_InvoiceBatchLine "
|
||||||
+ "WHERE C_InvoiceBatch_ID=? AND IsActive='Y'";
|
+ "WHERE C_InvoiceBatch_ID=? AND IsActive='Y'";
|
||||||
//
|
//
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, Record_ID);
|
pstmt.setInt(1, Record_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
// {0} - Number of lines
|
// {0} - Number of lines
|
||||||
|
@ -1777,13 +1794,17 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
arguments[2] = total;
|
arguments[2] = total;
|
||||||
filled = true;
|
filled = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, m_vo.TableName + "\nSQL=" + sql, e);
|
log.log(Level.SEVERE, m_vo.TableName + "\nSQL=" + sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
if (filled)
|
if (filled)
|
||||||
return mf.format (arguments);
|
return mf.format (arguments);
|
||||||
return " ";
|
return " ";
|
||||||
|
@ -2095,28 +2116,34 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
+ "FROM AD_Private_Access "
|
+ "FROM AD_Private_Access "
|
||||||
+ "WHERE AD_User_ID=? AND AD_Table_ID=? AND IsActive='Y' "
|
+ "WHERE AD_User_ID=? AND AD_Table_ID=? AND IsActive='Y' "
|
||||||
+ "ORDER BY Record_ID";
|
+ "ORDER BY Record_ID";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (m_Lock == null)
|
if (m_Lock == null)
|
||||||
m_Lock = new ArrayList<Integer>();
|
m_Lock = new ArrayList<Integer>();
|
||||||
else
|
else
|
||||||
m_Lock.clear();
|
m_Lock.clear();
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_User_ID);
|
pstmt.setInt(1, AD_User_ID);
|
||||||
pstmt.setInt(2, m_vo.AD_Table_ID);
|
pstmt.setInt(2, m_vo.AD_Table_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
Integer key = new Integer(rs.getInt(1));
|
Integer key = new Integer(rs.getInt(1));
|
||||||
m_Lock.add(key);
|
m_Lock.add(key);
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
}
|
||||||
log.fine("#" + m_Lock.size());
|
log.fine("#" + m_Lock.size());
|
||||||
} // loadLooks
|
} // loadLooks
|
||||||
|
|
||||||
|
|
|
@ -285,11 +285,13 @@ public class GridTabVO implements Evaluatee, Serializable
|
||||||
mTabVO.Fields = new ArrayList<GridFieldVO>();
|
mTabVO.Fields = new ArrayList<GridFieldVO>();
|
||||||
|
|
||||||
String sql = GridFieldVO.getSQL(mTabVO.ctx);
|
String sql = GridFieldVO.getSQL(mTabVO.ctx);
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, mTabVO.AD_Tab_ID);
|
pstmt.setInt(1, mTabVO.AD_Tab_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
GridFieldVO voF = GridFieldVO.create (mTabVO.ctx,
|
GridFieldVO voF = GridFieldVO.create (mTabVO.ctx,
|
||||||
|
@ -299,16 +301,18 @@ public class GridTabVO implements Evaluatee, Serializable
|
||||||
if (voF != null)
|
if (voF != null)
|
||||||
mTabVO.Fields.add(voF);
|
mTabVO.Fields.add(voF);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
CLogger.get().log(Level.SEVERE, "", e);
|
CLogger.get().log(Level.SEVERE, "", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
|
|
||||||
mTabVO.initFields = true;
|
mTabVO.initFields = true;
|
||||||
|
|
||||||
|
|
|
@ -112,11 +112,13 @@ public class GridWorkbench implements Serializable
|
||||||
+ " AND w.AD_Workbench_ID=t.AD_Workbench_ID"
|
+ " AND w.AD_Workbench_ID=t.AD_Workbench_ID"
|
||||||
+ " AND t.AD_Language='" + Env.getAD_Language(m_ctx) + "'"
|
+ " AND t.AD_Language='" + Env.getAD_Language(m_ctx) + "'"
|
||||||
+ " AND w.AD_Column_ID=c.AD_Column_ID";
|
+ " AND w.AD_Column_ID=c.AD_Column_ID";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Workbench_ID);
|
pstmt.setInt(1, AD_Workbench_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
Name = rs.getString(1);
|
Name = rs.getString(1);
|
||||||
|
@ -135,13 +137,17 @@ public class GridWorkbench implements Serializable
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AD_Workbench_ID = 0;
|
AD_Workbench_ID = 0;
|
||||||
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 (AD_Workbench_ID == 0)
|
if (AD_Workbench_ID == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -268,11 +274,13 @@ public class GridWorkbench implements Serializable
|
||||||
+ "FROM AD_WorkbenchWindow "
|
+ "FROM AD_WorkbenchWindow "
|
||||||
+ "WHERE AD_Workbench_ID=? AND IsActive='Y'"
|
+ "WHERE AD_Workbench_ID=? AND IsActive='Y'"
|
||||||
+ "ORDER BY SeqNo";
|
+ "ORDER BY SeqNo";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Workbench_ID);
|
pstmt.setInt(1, AD_Workbench_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int AD_Window_ID = rs.getInt(1);
|
int AD_Window_ID = rs.getInt(1);
|
||||||
|
@ -289,14 +297,18 @@ public class GridWorkbench implements Serializable
|
||||||
else if (AD_Task_ID > 0)
|
else if (AD_Task_ID > 0)
|
||||||
m_windows.add (new WBWindow(TYPE_TASK, AD_Task_ID));
|
m_windows.add (new WBWindow(TYPE_TASK, AD_Task_ID));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} // initWorkbenchWindows
|
} // initWorkbenchWindows
|
||||||
|
|
||||||
|
|
|
@ -52,29 +52,25 @@ public class MArchive extends X_AD_Archive {
|
||||||
*/
|
*/
|
||||||
public static MArchive[] get(Properties ctx, String whereClause) {
|
public static MArchive[] get(Properties ctx, String whereClause) {
|
||||||
ArrayList<MArchive> list = new ArrayList<MArchive>();
|
ArrayList<MArchive> list = new ArrayList<MArchive>();
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
StringBuilder sql = new StringBuilder("SELECT * FROM AD_Archive WHERE AD_Client_ID=?");
|
StringBuilder sql = new StringBuilder("SELECT * FROM AD_Archive WHERE AD_Client_ID=?");
|
||||||
if (whereClause != null && whereClause.length() > 0)
|
if (whereClause != null && whereClause.length() > 0)
|
||||||
sql.append(whereClause);
|
sql.append(whereClause);
|
||||||
sql.append(" ORDER BY Created");
|
sql.append(" ORDER BY Created");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, Env.getAD_Client_ID(ctx));
|
pstmt.setInt(1, Env.getAD_Client_ID(ctx));
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MArchive(ctx, rs, null));
|
list.add(new MArchive(ctx, rs, null));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try {
|
finally
|
||||||
if (pstmt != null)
|
{
|
||||||
pstmt.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt = null;
|
rs = null;
|
||||||
} catch (Exception e) {
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
|
@ -206,23 +202,20 @@ public class MArchive extends X_AD_Archive {
|
||||||
String name = "?";
|
String name = "?";
|
||||||
String sql = "SELECT Name FROM AD_User WHERE AD_User_ID=?";
|
String sql = "SELECT Name FROM AD_User WHERE AD_User_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, getCreatedBy());
|
pstmt.setInt(1, getCreatedBy());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
name = rs.getString(1);
|
name = rs.getString(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try {
|
finally
|
||||||
if (pstmt != null)
|
{
|
||||||
pstmt.close();
|
DB.close(rs, pstmt);
|
||||||
pstmt = null;
|
rs = null;
|
||||||
} catch (Exception e) {
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
|
|
|
@ -71,37 +71,31 @@ public class MBPGroup extends X_C_BP_Group
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
String sql = "SELECT * FROM C_BP_Group g "
|
String sql = "SELECT * FROM C_BP_Group g "
|
||||||
+ "WHERE IsDefault='Y' AND AD_Client_ID=? "
|
+ "WHERE IsDefault='Y' AND AD_Client_ID=? "
|
||||||
+ "ORDER BY IsActive DESC";
|
+ "ORDER BY IsActive DESC";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, AD_Client_ID);
|
pstmt.setInt (1, AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
retValue = new MBPGroup (ctx, rs, null);
|
retValue = new MBPGroup (ctx, rs, null);
|
||||||
if (retValue.get_ID () != 0)
|
if (retValue.get_ID () != 0)
|
||||||
s_cacheDefault.put (key, retValue);
|
s_cacheDefault.put (key, retValue);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
|
@ -119,6 +113,7 @@ public class MBPGroup extends X_C_BP_Group
|
||||||
{
|
{
|
||||||
MBPGroup retValue = null;
|
MBPGroup retValue = null;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
String sql = "SELECT * FROM C_BP_Group g "
|
String sql = "SELECT * FROM C_BP_Group g "
|
||||||
+ "WHERE EXISTS (SELECT * FROM C_BPartner p "
|
+ "WHERE EXISTS (SELECT * FROM C_BPartner p "
|
||||||
+ "WHERE p.C_BPartner_ID=? AND p.C_BP_Group_ID=g.C_BP_Group_ID)";
|
+ "WHERE p.C_BPartner_ID=? AND p.C_BP_Group_ID=g.C_BP_Group_ID)";
|
||||||
|
@ -126,7 +121,7 @@ public class MBPGroup extends X_C_BP_Group
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, C_BPartner_ID);
|
pstmt.setInt (1, C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
retValue = new MBPGroup (ctx, rs, null);
|
retValue = new MBPGroup (ctx, rs, null);
|
||||||
|
@ -134,22 +129,15 @@ public class MBPGroup extends X_C_BP_Group
|
||||||
if (retValue.get_ID () != 0)
|
if (retValue.get_ID () != 0)
|
||||||
s_cache.put (key, retValue);
|
s_cache.put (key, retValue);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,29 +150,23 @@ public class MBPartner extends X_C_BPartner
|
||||||
+ " INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) "
|
+ " INNER JOIN C_Order o ON (ol.C_Order_ID=o.C_Order_ID) "
|
||||||
+ "WHERE o.IsSOTrx='Y' AND Bill_BPartner_ID=?";
|
+ "WHERE o.IsSOTrx='Y' AND Bill_BPartner_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, C_BPartner_ID);
|
pstmt.setInt (1, C_BPartner_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
retValue = rs.getBigDecimal(1);
|
retValue = rs.getBigDecimal(1);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -314,11 +308,12 @@ public class MBPartner extends X_C_BPartner
|
||||||
String sql = "SELECT * FROM C_BPartner "
|
String sql = "SELECT * FROM C_BPartner "
|
||||||
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Client_ID);
|
pstmt.setInt(1, AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
success = load (rs);
|
success = load (rs);
|
||||||
else
|
else
|
||||||
|
@ -327,9 +322,6 @@ public class MBPartner extends X_C_BPartner
|
||||||
success = false;
|
success = false;
|
||||||
log.severe ("None found");
|
log.severe ("None found");
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -337,13 +329,8 @@ public class MBPartner extends X_C_BPartner
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
setStandardDefaults();
|
setStandardDefaults();
|
||||||
|
@ -492,16 +479,14 @@ public class MBPartner extends X_C_BPartner
|
||||||
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
|
ArrayList<MBPBankAccount> list = new ArrayList<MBPBankAccount>();
|
||||||
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND IsActive='Y'";
|
String sql = "SELECT * FROM C_BP_BankAccount WHERE C_BPartner_ID=? AND IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getC_BPartner_ID());
|
pstmt.setInt(1, getC_BPartner_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MBPBankAccount (getCtx(), rs, get_TrxName()));
|
list.add(new MBPBankAccount (getCtx(), rs, get_TrxName()));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -509,13 +494,8 @@ public class MBPartner extends X_C_BPartner
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,32 +669,26 @@ public class MBPartner extends X_C_BPartner
|
||||||
+ "FROM C_BPartner bp "
|
+ "FROM C_BPartner bp "
|
||||||
+ "WHERE C_BPartner_ID=?";
|
+ "WHERE C_BPartner_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_BPartner_ID());
|
pstmt.setInt (1, getC_BPartner_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
SO_CreditUsed = rs.getBigDecimal(1);
|
SO_CreditUsed = rs.getBigDecimal(1);
|
||||||
TotalOpenBalance = rs.getBigDecimal(2);
|
TotalOpenBalance = rs.getBigDecimal(2);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -739,29 +713,23 @@ public class MBPartner extends X_C_BPartner
|
||||||
+ "FROM C_BPartner bp "
|
+ "FROM C_BPartner bp "
|
||||||
+ "WHERE C_BPartner_ID=?";
|
+ "WHERE C_BPartner_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_BPartner_ID());
|
pstmt.setInt (1, getC_BPartner_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
ActualLifeTimeValue = rs.getBigDecimal(1);
|
ActualLifeTimeValue = rs.getBigDecimal(1);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (ActualLifeTimeValue != null)
|
if (ActualLifeTimeValue != null)
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class MBPartnerInfo extends X_RV_BPartner
|
||||||
"RV_BPartner", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
"RV_BPartner", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||||
ArrayList<MBPartnerInfo> list = new ArrayList<MBPartnerInfo>();
|
ArrayList<MBPartnerInfo> list = new ArrayList<MBPartnerInfo>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(finalSQL, null);
|
pstmt = DB.prepareStatement(finalSQL, null);
|
||||||
|
@ -116,25 +117,18 @@ public class MBPartnerInfo extends X_RV_BPartner
|
||||||
pstmt.setString(index++, Phone);
|
pstmt.setString(index++, Phone);
|
||||||
if (City != null)
|
if (City != null)
|
||||||
pstmt.setString(index++, City);
|
pstmt.setString(index++, City);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MBPartnerInfo (ctx, rs, null));
|
list.add(new MBPartnerInfo (ctx, rs, null));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "find - " + finalSQL, e);
|
s_log.log(Level.SEVERE, "find - " + finalSQL, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// Return
|
// Return
|
||||||
|
|
|
@ -94,23 +94,29 @@ public class MBankAccountProcessor extends X_C_BankAccount_Processor {
|
||||||
sql.append(" AND bap.AcceptCORPORATE='Y'");
|
sql.append(" AND bap.AcceptCORPORATE='Y'");
|
||||||
sql.append(" ORDER BY ba.IsDefault DESC ");
|
sql.append(" ORDER BY ba.IsDefault DESC ");
|
||||||
//
|
//
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), trxName);
|
pstmt = DB.prepareStatement(sql.toString(), trxName);
|
||||||
pstmt.setInt(1, AD_Client_ID);
|
pstmt.setInt(1, AD_Client_ID);
|
||||||
pstmt.setInt(2, C_Currency_ID);
|
pstmt.setInt(2, C_Currency_ID);
|
||||||
pstmt.setBigDecimal(3, Amt);
|
pstmt.setBigDecimal(3, Amt);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MBankAccountProcessor (ctx, rs, trxName));
|
list.add(new MBankAccountProcessor (ctx, rs, trxName));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "find - " + sql, e);
|
s_log.log(Level.SEVERE, "find - " + sql, e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
if (list.size() == 0)
|
if (list.size() == 0)
|
||||||
s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID
|
s_log.warning("find - not found - AD_Client_ID=" + AD_Client_ID
|
||||||
|
|
|
@ -55,28 +55,22 @@ public class MBankStatementMatcher extends X_C_BankStatementMatcher
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
int AD_Client_ID = Env.getAD_Client_ID(ctx);
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add (new MBankStatementMatcher(ctx, rs, trxName));
|
list.add (new MBankStatementMatcher(ctx, rs, trxName));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// Convert
|
// Convert
|
||||||
|
|
|
@ -48,33 +48,27 @@ public class MCStage extends X_CM_CStage
|
||||||
public static MCStage[] getStages (MWebProject project)
|
public static MCStage[] getStages (MWebProject project)
|
||||||
{
|
{
|
||||||
ArrayList<MCStage> list = new ArrayList<MCStage>();
|
ArrayList<MCStage> list = new ArrayList<MCStage>();
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
String sql = "SELECT * FROM CM_CStage WHERE CM_WebProject_ID=? ORDER BY CM_CStage_ID";
|
String sql = "SELECT * FROM CM_CStage WHERE CM_WebProject_ID=? ORDER BY CM_CStage_ID";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, project.get_TrxName());
|
pstmt = DB.prepareStatement (sql, project.get_TrxName());
|
||||||
pstmt.setInt (1, project.getCM_WebProject_ID());
|
pstmt.setInt (1, project.getCM_WebProject_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MCStage (project.getCtx(), rs, project.get_TrxName()));
|
list.add (new MCStage (project.getCtx(), rs, project.get_TrxName()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MCStage[] retValue = new MCStage[list.size ()];
|
MCStage[] retValue = new MCStage[list.size ()];
|
||||||
|
|
|
@ -118,9 +118,6 @@ public class MCashPlan extends X_C_CashPlan
|
||||||
MCashPlanLine il = new MCashPlanLine(getCtx(), rs, get_TrxName());
|
MCashPlanLine il = new MCashPlanLine(getCtx(), rs, get_TrxName());
|
||||||
list.add(il);
|
list.add(il);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,31 +52,25 @@ public class MClick extends X_W_Click
|
||||||
ArrayList<MClick> list = new ArrayList<MClick> ();
|
ArrayList<MClick> list = new ArrayList<MClick> ();
|
||||||
String sql = "SELECT * FROM W_Click WHERE AD_Client_ID=? AND Processed = 'N'";
|
String sql = "SELECT * FROM W_Click WHERE AD_Client_ID=? AND Processed = 'N'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MClick (ctx, rs, null));
|
list.add (new MClick (ctx, rs, null));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
@ -199,12 +193,13 @@ public class MClick extends X_W_Click
|
||||||
int W_ClickCount_ID = 0;
|
int W_ClickCount_ID = 0;
|
||||||
int exactW_ClickCount_ID = 0;
|
int exactW_ClickCount_ID = 0;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
StringBuilder msgstr = new StringBuilder("%").append(url).append("%");
|
StringBuilder msgstr = new StringBuilder("%").append(url).append("%");
|
||||||
pstmt.setString(1, msgstr.toString());
|
pstmt.setString(1, msgstr.toString());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
W_ClickCount_ID = rs.getInt(1);
|
W_ClickCount_ID = rs.getInt(1);
|
||||||
|
@ -214,23 +209,17 @@ public class MClick extends X_W_Click
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, ex);
|
log.log(Level.SEVERE, sql, ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
// Set Click Count
|
// Set Click Count
|
||||||
if (exactW_ClickCount_ID != 0)
|
if (exactW_ClickCount_ID != 0)
|
||||||
W_ClickCount_ID = exactW_ClickCount_ID;
|
W_ClickCount_ID = exactW_ClickCount_ID;
|
||||||
|
|
|
@ -114,11 +114,12 @@ public class MClickCount extends X_W_ClickCount
|
||||||
.append("GROUP BY TRUNC(Created, '").append(DateFormat).append("')");
|
.append("GROUP BY TRUNC(Created, '").append(DateFormat).append("')");
|
||||||
//
|
//
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, getW_ClickCount_ID());
|
pstmt.setInt(1, getW_ClickCount_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String value = m_dateFormat.format(rs.getTimestamp(1));
|
String value = m_dateFormat.format(rs.getTimestamp(1));
|
||||||
|
@ -126,23 +127,17 @@ public class MClickCount extends X_W_ClickCount
|
||||||
ValueNamePair pp = new ValueNamePair (value, name);
|
ValueNamePair pp = new ValueNamePair (value, name);
|
||||||
list.add(pp);
|
list.add(pp);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql.toString(), ex);
|
log.log(Level.SEVERE, sql.toString(), ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
//
|
//
|
||||||
ValueNamePair[] retValue = new ValueNamePair[list.size()];
|
ValueNamePair[] retValue = new ValueNamePair[list.size()];
|
||||||
list.toArray(retValue);
|
list.toArray(retValue);
|
||||||
|
|
|
@ -303,10 +303,12 @@ public class MClient extends X_AD_Client
|
||||||
AD_Tree_Campaign_ID=0, AD_Tree_Activity_ID=0;
|
AD_Tree_Campaign_ID=0, AD_Tree_Activity_ID=0;
|
||||||
|
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement stmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
stmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
ResultSet rs = stmt.executeQuery();
|
rs = stmt.executeQuery();
|
||||||
MTree_Base tree = null;
|
MTree_Base tree = null;
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
|
@ -374,13 +376,17 @@ public class MClient extends X_AD_Client
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e1)
|
catch (SQLException e1)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "Trees", e1);
|
log.log(Level.SEVERE, "Trees", e1);
|
||||||
success = false;
|
success = false;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null;
|
||||||
|
stmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success)
|
if (!success)
|
||||||
|
|
|
@ -68,34 +68,29 @@ public class MClientInfo extends X_AD_ClientInfo
|
||||||
//
|
//
|
||||||
String sql = "SELECT * FROM AD_ClientInfo WHERE AD_Client_ID=?";
|
String sql = "SELECT * FROM AD_ClientInfo WHERE AD_Client_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
pstmt = DB.prepareStatement (sql, trxName);
|
||||||
pstmt.setInt (1, AD_Client_ID);
|
pstmt.setInt (1, AD_Client_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
{
|
{
|
||||||
info = new MClientInfo (ctx, rs, null);
|
info = new MClientInfo (ctx, rs, null);
|
||||||
if (trxName == null)
|
if (trxName == null)
|
||||||
s_cache.put (key, info);
|
s_cache.put (key, info);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, ex);
|
s_log.log(Level.SEVERE, sql, ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close ();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
//
|
//
|
||||||
return info;
|
return info;
|
||||||
} // get
|
} // get
|
||||||
|
|
|
@ -80,10 +80,11 @@ public class MClientShare extends X_AD_ClientShare
|
||||||
String sql = "SELECT AD_Client_ID, AD_Table_ID, ShareType "
|
String sql = "SELECT AD_Client_ID, AD_Table_ID, ShareType "
|
||||||
+ "FROM AD_ClientShare WHERE ShareType<>'x' AND IsActive='Y'";
|
+ "FROM AD_ClientShare WHERE ShareType<>'x' AND IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int Client_ID = rs.getInt(1);
|
int Client_ID = rs.getInt(1);
|
||||||
|
@ -95,22 +96,15 @@ public class MClientShare extends X_AD_ClientShare
|
||||||
else if (ShareType.equals(SHARETYPE_OrgNotShared))
|
else if (ShareType.equals(SHARETYPE_OrgNotShared))
|
||||||
s_shares.put(key.toString(), Boolean.FALSE);
|
s_shares.put(key.toString(), Boolean.FALSE);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (s_shares.isEmpty()) // put in something
|
if (s_shares.isEmpty()) // put in something
|
||||||
|
@ -249,11 +243,12 @@ public class MClientShare extends X_AD_ClientShare
|
||||||
+ " AND c.ColumnName IN (SELECT ColumnName FROM AD_Column cc "
|
+ " AND c.ColumnName IN (SELECT ColumnName FROM AD_Column cc "
|
||||||
+ "WHERE cc.IsKey='Y' AND cc.AD_Table_ID=?))";
|
+ "WHERE cc.IsKey='Y' AND cc.AD_Table_ID=?))";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, getAD_Table_ID());
|
pstmt.setInt (1, getAD_Table_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
//int AD_Table_ID = rs.getInt(1);
|
//int AD_Table_ID = rs.getInt(1);
|
||||||
|
@ -262,22 +257,15 @@ public class MClientShare extends X_AD_ClientShare
|
||||||
info.append(", ");
|
info.append(", ");
|
||||||
info.append(TableName);
|
info.append(TableName);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
log.info(info.toString());
|
log.info(info.toString());
|
||||||
|
|
|
@ -558,22 +558,28 @@ public class MColumn extends X_AD_Column
|
||||||
|
|
||||||
int retValue = 0;
|
int retValue = 0;
|
||||||
String SQL = "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID = ? AND columnname = ?";
|
String SQL = "SELECT AD_Column_ID FROM AD_Column WHERE AD_Table_ID = ? AND columnname = ?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
pstmt = DB.prepareStatement(SQL, null);
|
||||||
pstmt.setInt(1, m_table_id);
|
pstmt.setInt(1, m_table_id);
|
||||||
pstmt.setString(2, columnName);
|
pstmt.setString(2, columnName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
retValue = rs.getInt(1);
|
retValue = rs.getInt(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, SQL, e);
|
s_log.log(Level.SEVERE, SQL, e);
|
||||||
retValue = -1;
|
retValue = -1;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
}
|
}
|
||||||
//end vpj-cd e-evolution
|
//end vpj-cd e-evolution
|
||||||
|
|
|
@ -126,11 +126,12 @@ public class MColumnAccess extends X_AD_Column_Access
|
||||||
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
+ "FROM AD_Table t INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
||||||
+ "WHERE AD_Column_ID=?";
|
+ "WHERE AD_Column_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getAD_Column_ID());
|
pstmt.setInt(1, getAD_Column_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
m_tableName = rs.getString(1);
|
m_tableName = rs.getString(1);
|
||||||
|
@ -138,22 +139,15 @@ public class MColumnAccess extends X_AD_Column_Access
|
||||||
if (rs.getInt(3) != getAD_Table_ID())
|
if (rs.getInt(3) != getAD_Table_ID())
|
||||||
log.log(Level.SEVERE, "AD_Table_ID inconsistent - Access=" + getAD_Table_ID() + " - Table=" + rs.getInt(3));
|
log.log(Level.SEVERE, "AD_Table_ID inconsistent - Access=" + getAD_Table_ID() + " - Table=" + rs.getInt(3));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// Get Clear Text
|
// Get Clear Text
|
||||||
|
|
|
@ -226,6 +226,7 @@ public class MConversionRate extends X_C_Conversion_Rate
|
||||||
+ "ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC";
|
+ "ORDER BY AD_Client_ID DESC, AD_Org_ID DESC, ValidFrom DESC";
|
||||||
BigDecimal retValue = null;
|
BigDecimal retValue = null;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
|
@ -235,27 +236,20 @@ public class MConversionRate extends X_C_Conversion_Rate
|
||||||
pstmt.setTimestamp(4, ConvDate);
|
pstmt.setTimestamp(4, ConvDate);
|
||||||
pstmt.setInt(5, AD_Client_ID);
|
pstmt.setInt(5, AD_Client_ID);
|
||||||
pstmt.setInt(6, AD_Org_ID);
|
pstmt.setInt(6, AD_Org_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
retValue = rs.getBigDecimal(1);
|
retValue = rs.getBigDecimal(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getRate", e);
|
s_log.log(Level.SEVERE, "getRate", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
s_log.info ("getRate - not found - CurFrom=" + CurFrom_ID
|
s_log.info ("getRate - not found - CurFrom=" + CurFrom_ID
|
||||||
+ ", CurTo=" + CurTo_ID
|
+ ", CurTo=" + CurTo_ID
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class MCostQueue extends X_M_CostQueue
|
||||||
+ " AND M_CostType_ID=? AND C_AcctSchema_ID=?"
|
+ " AND M_CostType_ID=? AND C_AcctSchema_ID=?"
|
||||||
+ " AND M_CostElement_ID=?";
|
+ " AND M_CostElement_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
pstmt = DB.prepareStatement (sql, trxName);
|
||||||
|
@ -73,25 +74,18 @@ public class MCostQueue extends X_M_CostQueue
|
||||||
pstmt.setInt (5, as.getM_CostType_ID());
|
pstmt.setInt (5, as.getM_CostType_ID());
|
||||||
pstmt.setInt (6, as.getC_AcctSchema_ID());
|
pstmt.setInt (6, as.getC_AcctSchema_ID());
|
||||||
pstmt.setInt (7, M_CostElement_ID);
|
pstmt.setInt (7, M_CostElement_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
costQ = new MCostQueue (product.getCtx(), rs, trxName);
|
costQ = new MCostQueue (product.getCtx(), rs, trxName);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// New
|
// New
|
||||||
|
@ -127,6 +121,7 @@ public class MCostQueue extends X_M_CostQueue
|
||||||
if (!ce.isFifo())
|
if (!ce.isFifo())
|
||||||
sql.append("DESC");
|
sql.append("DESC");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
||||||
|
@ -138,25 +133,18 @@ public class MCostQueue extends X_M_CostQueue
|
||||||
pstmt.setInt (6, ce.getM_CostElement_ID());
|
pstmt.setInt (6, ce.getM_CostElement_ID());
|
||||||
if (M_ASI_ID != 0)
|
if (M_ASI_ID != 0)
|
||||||
pstmt.setInt (7, M_ASI_ID);
|
pstmt.setInt (7, M_ASI_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MCostQueue (product.getCtx(), rs, trxName));
|
list.add(new MCostQueue (product.getCtx(), rs, trxName));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql.toString(), e);
|
s_log.log (Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MCostQueue[] costQ = new MCostQueue[list.size()];
|
MCostQueue[] costQ = new MCostQueue[list.size()];
|
||||||
|
|
|
@ -113,10 +113,12 @@ public final class MCountry extends X_C_Country
|
||||||
//
|
//
|
||||||
s_countries = new CCache<String,MCountry>(Table_Name, 250);
|
s_countries = new CCache<String,MCountry>(Table_Name, 250);
|
||||||
String sql = "SELECT * FROM C_Country WHERE IsActive='Y'";
|
String sql = "SELECT * FROM C_Country WHERE IsActive='Y'";
|
||||||
|
Statement stmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Statement stmt = DB.createStatement();
|
stmt = DB.createStatement();
|
||||||
ResultSet rs = stmt.executeQuery(sql);
|
rs = stmt.executeQuery(sql);
|
||||||
while(rs.next())
|
while(rs.next())
|
||||||
{
|
{
|
||||||
MCountry c = new MCountry (ctx, rs, null);
|
MCountry c = new MCountry (ctx, rs, null);
|
||||||
|
@ -127,13 +129,17 @@ public final class MCountry extends X_C_Country
|
||||||
if (c.getC_Country_ID() == COUNTRY_US) // USA
|
if (c.getC_Country_ID() == COUNTRY_US) // USA
|
||||||
usa = c;
|
usa = c;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
stmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, stmt);
|
||||||
|
rs = null;
|
||||||
|
stmt = null;
|
||||||
|
}
|
||||||
if (s_default == null)
|
if (s_default == null)
|
||||||
s_default = usa;
|
s_default = usa;
|
||||||
s_log.fine("#" + s_countries.size()
|
s_log.fine("#" + s_countries.size()
|
||||||
|
|
|
@ -85,11 +85,13 @@ public class MDesktop
|
||||||
.append("WHERE w.AD_Desktop_ID=? AND w.IsActive='Y'")
|
.append("WHERE w.AD_Desktop_ID=? AND w.IsActive='Y'")
|
||||||
.append(" AND w.AD_Desktop_ID=t.AD_Desktop_ID")
|
.append(" AND w.AD_Desktop_ID=t.AD_Desktop_ID")
|
||||||
.append(" AND t.AD_Language='").append(Env.getAD_Language(m_ctx)).append("'");
|
.append(" AND t.AD_Language='").append(Env.getAD_Language(m_ctx)).append("'");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||||
pstmt.setInt(1, AD_Desktop_ID);
|
pstmt.setInt(1, AD_Desktop_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
Name = rs.getString(1);
|
Name = rs.getString(1);
|
||||||
|
@ -107,13 +109,17 @@ public class MDesktop
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
AD_Desktop_ID = 0;
|
AD_Desktop_ID = 0;
|
||||||
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;
|
||||||
|
}
|
||||||
|
|
||||||
if (AD_Desktop_ID == 0)
|
if (AD_Desktop_ID == 0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -207,24 +213,30 @@ public class MDesktop
|
||||||
+ "FROM AD_DesktopWorkbench "
|
+ "FROM AD_DesktopWorkbench "
|
||||||
+ "WHERE AD_Desktop_ID=? AND IsActive='Y' "
|
+ "WHERE AD_Desktop_ID=? AND IsActive='Y' "
|
||||||
+ "ORDER BY SeqNo";
|
+ "ORDER BY SeqNo";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_Desktop_ID);
|
pstmt.setInt(1, AD_Desktop_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
int AD_Workbench_ID = rs.getInt(1);
|
int AD_Workbench_ID = rs.getInt(1);
|
||||||
m_workbenches.add (new Integer(AD_Workbench_ID));
|
m_workbenches.add (new Integer(AD_Workbench_ID));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "MWorkbench.initDesktopWorkbenches", e);
|
log.log(Level.SEVERE, "MWorkbench.initDesktopWorkbenches", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
} // initDesktopWorkbenches
|
} // initDesktopWorkbenches
|
||||||
|
|
||||||
|
|
|
@ -115,29 +115,23 @@ public class MDiscountSchema extends X_M_DiscountSchema
|
||||||
String sql = "SELECT * FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=? ORDER BY SeqNo";
|
String sql = "SELECT * FROM M_DiscountSchemaBreak WHERE M_DiscountSchema_ID=? ORDER BY SeqNo";
|
||||||
ArrayList<MDiscountSchemaBreak> list = new ArrayList<MDiscountSchemaBreak>();
|
ArrayList<MDiscountSchemaBreak> list = new ArrayList<MDiscountSchemaBreak>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getM_DiscountSchema_ID());
|
pstmt.setInt (1, getM_DiscountSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MDiscountSchemaBreak(getCtx(), rs, get_TrxName()));
|
list.add(new MDiscountSchemaBreak(getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
m_breaks = new MDiscountSchemaBreak[list.size ()];
|
m_breaks = new MDiscountSchemaBreak[list.size ()];
|
||||||
|
@ -160,29 +154,23 @@ public class MDiscountSchema extends X_M_DiscountSchema
|
||||||
String sql = "SELECT * FROM M_DiscountSchemaLine WHERE M_DiscountSchema_ID=? ORDER BY SeqNo";
|
String sql = "SELECT * FROM M_DiscountSchemaLine WHERE M_DiscountSchema_ID=? ORDER BY SeqNo";
|
||||||
ArrayList<MDiscountSchemaLine> list = new ArrayList<MDiscountSchemaLine>();
|
ArrayList<MDiscountSchemaLine> list = new ArrayList<MDiscountSchemaLine>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getM_DiscountSchema_ID());
|
pstmt.setInt (1, getM_DiscountSchema_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MDiscountSchemaLine(getCtx(), rs, get_TrxName()));
|
list.add(new MDiscountSchemaLine(getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
m_lines = new MDiscountSchemaLine[list.size ()];
|
m_lines = new MDiscountSchemaLine[list.size ()];
|
||||||
|
|
|
@ -73,11 +73,12 @@ public class MDistributionList extends X_M_DistributionList
|
||||||
//
|
//
|
||||||
String sql = "SELECT * FROM M_DistributionListLine WHERE M_DistributionList_ID=?";
|
String sql = "SELECT * FROM M_DistributionListLine WHERE M_DistributionList_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getM_DistributionList_ID());
|
pstmt.setInt (1, getM_DistributionList_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MDistributionListLine line = new MDistributionListLine(getCtx(), rs, get_TrxName());
|
MDistributionListLine line = new MDistributionListLine(getCtx(), rs, get_TrxName());
|
||||||
|
@ -86,22 +87,15 @@ public class MDistributionList extends X_M_DistributionList
|
||||||
if (ratio != null)
|
if (ratio != null)
|
||||||
ratioTotal = ratioTotal.add(ratio);
|
ratioTotal = ratioTotal.add(ratio);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "getLines", e);
|
log.log(Level.SEVERE, "getLines", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// Update Ratio
|
// Update Ratio
|
||||||
|
|
|
@ -79,29 +79,23 @@ public class MDistributionRun extends X_M_DistributionRun
|
||||||
+ "WHERE M_DistributionRun_ID=? AND IsActive='Y' AND TotalQty IS NOT NULL AND TotalQty<> 0 ORDER BY Line";
|
+ "WHERE M_DistributionRun_ID=? AND IsActive='Y' AND TotalQty IS NOT NULL AND TotalQty<> 0 ORDER BY Line";
|
||||||
ArrayList<MDistributionRunLine> list = new ArrayList<MDistributionRunLine>();
|
ArrayList<MDistributionRunLine> list = new ArrayList<MDistributionRunLine>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getM_DistributionRun_ID());
|
pstmt.setInt (1, getM_DistributionRun_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MDistributionRunLine(getCtx(), rs, get_TrxName()));
|
list.add (new MDistributionRunLine(getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
m_lines = new MDistributionRunLine[list.size()];
|
m_lines = new MDistributionRunLine[list.size()];
|
||||||
|
|
|
@ -58,29 +58,23 @@ public class MDistributionRunDetail extends X_T_DistributionRunDetail
|
||||||
else
|
else
|
||||||
sql.append("ORDER BY M_DistributionRunLine_ID");
|
sql.append("ORDER BY M_DistributionRunLine_ID");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
||||||
pstmt.setInt (1, M_DistributionRun_ID);
|
pstmt.setInt (1, M_DistributionRun_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MDistributionRunDetail(ctx, rs, trxName));
|
list.add(new MDistributionRunDetail(ctx, rs, trxName));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MDistributionRunDetail[] retValue = new MDistributionRunDetail[list.size()];
|
MDistributionRunDetail[] retValue = new MDistributionRunDetail[list.size()];
|
||||||
|
|
|
@ -99,11 +99,12 @@ public class MDocTypeCounter extends X_C_DocTypeCounter
|
||||||
MDocTypeCounter temp = null;
|
MDocTypeCounter temp = null;
|
||||||
String sql = "SELECT * FROM C_DocTypeCounter WHERE C_DocType_ID=?";
|
String sql = "SELECT * FROM C_DocTypeCounter WHERE C_DocType_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, C_DocType_ID);
|
pstmt.setInt (1, C_DocType_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next () && retValue == null)
|
while (rs.next () && retValue == null)
|
||||||
{
|
{
|
||||||
retValue = new MDocTypeCounter (ctx, rs, null);
|
retValue = new MDocTypeCounter (ctx, rs, null);
|
||||||
|
@ -113,22 +114,15 @@ public class MDocTypeCounter extends X_C_DocTypeCounter
|
||||||
retValue = null;
|
retValue = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getCounterDocType", e);
|
s_log.log(Level.SEVERE, "getCounterDocType", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (retValue != null) // valid
|
if (retValue != null) // valid
|
||||||
|
|
|
@ -88,31 +88,25 @@ public class MDunningLevel extends X_C_DunningLevel
|
||||||
ArrayList<MDunningLevel> list = new ArrayList<MDunningLevel>();
|
ArrayList<MDunningLevel> list = new ArrayList<MDunningLevel>();
|
||||||
String sql = "SELECT * FROM C_DunningLevel WHERE C_Dunning_ID=? AND DaysAfterDue+DaysBetweenDunning<?";
|
String sql = "SELECT * FROM C_DunningLevel WHERE C_Dunning_ID=? AND DaysAfterDue+DaysBetweenDunning<?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getParent().get_ID ());
|
pstmt.setInt(1, getParent().get_ID ());
|
||||||
int totalDays = getDaysAfterDue ().intValue ()+getDaysBetweenDunning ();
|
int totalDays = getDaysAfterDue ().intValue ()+getDaysBetweenDunning ();
|
||||||
pstmt.setInt(2, totalDays);
|
pstmt.setInt(2, totalDays);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MDunningLevel(getCtx(), rs, get_TrxName()));
|
list.add(new MDunningLevel(getCtx(), rs, get_TrxName()));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,33 +133,27 @@ public class MDunningRun extends X_C_DunningRun
|
||||||
String sql = "SELECT * FROM C_DunningRunEntry WHERE C_DunningRun_ID=? ORDER BY C_DunningLevel_ID, C_DunningRunEntry_ID";
|
String sql = "SELECT * FROM C_DunningRunEntry WHERE C_DunningRun_ID=? ORDER BY C_DunningLevel_ID, C_DunningRunEntry_ID";
|
||||||
ArrayList<MDunningRunEntry> list = new ArrayList<MDunningRunEntry>();
|
ArrayList<MDunningRunEntry> list = new ArrayList<MDunningRunEntry>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_DunningRun_ID());
|
pstmt.setInt (1, getC_DunningRun_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MDunningRunEntry thisEntry = new MDunningRunEntry(getCtx(), rs, get_TrxName());
|
MDunningRunEntry thisEntry = new MDunningRunEntry(getCtx(), rs, get_TrxName());
|
||||||
if (!(onlyInvoices && thisEntry.hasInvoices()))
|
if (!(onlyInvoices && thisEntry.hasInvoices()))
|
||||||
list.add (new MDunningRunEntry(getCtx(), rs, get_TrxName()));
|
list.add (new MDunningRunEntry(getCtx(), rs, get_TrxName()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
m_entries = new MDunningRunEntry[list.size ()];
|
m_entries = new MDunningRunEntry[list.size ()];
|
||||||
|
|
|
@ -204,29 +204,23 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
||||||
if (onlyInvoices)
|
if (onlyInvoices)
|
||||||
sql.append(" AND C_Invoice_ID IS NOT NULL");
|
sql.append(" AND C_Invoice_ID IS NOT NULL");
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||||
pstmt.setInt(1, get_ID ());
|
pstmt.setInt(1, get_ID ());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MDunningRunLine(getCtx(), rs, get_TrxName()));
|
list.add(new MDunningRunLine(getCtx(), rs, get_TrxName()));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,34 +239,28 @@ public class MDunningRunEntry extends X_C_DunningRunEntry
|
||||||
boolean retValue = false;
|
boolean retValue = false;
|
||||||
String sql = "SELECT COUNT(*) FROM C_DunningRunLine WHERE C_DunningRunEntry_ID=? AND C_Invoice_ID IS NOT NULL";
|
String sql = "SELECT COUNT(*) FROM C_DunningRunLine WHERE C_DunningRunEntry_ID=? AND C_Invoice_ID IS NOT NULL";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, get_ID ());
|
pstmt.setInt(1, get_ID ());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
if (rs.getInt(1) > 0)
|
if (rs.getInt(1) > 0)
|
||||||
retValue = true;
|
retValue = true;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // hasInvoices
|
} // hasInvoices
|
||||||
|
|
||||||
|
|
|
@ -78,25 +78,22 @@ public class MEXPFormatLine extends X_EXP_FormatLine {
|
||||||
.append(" AND ").append(X_EXP_Format.COLUMNNAME_EXP_Format_ID).append(" = ?")
|
.append(" AND ").append(X_EXP_Format.COLUMNNAME_EXP_Format_ID).append(" = ?")
|
||||||
;
|
;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
||||||
pstmt.setString(1, value);
|
pstmt.setString(1, value);
|
||||||
pstmt.setInt(2, EXP_Format_ID);
|
pstmt.setInt(2, EXP_Format_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if ( rs.next() ) {
|
if ( rs.next() ) {
|
||||||
result = new MEXPFormatLine (ctx, rs, trxName);
|
result = new MEXPFormatLine (ctx, rs, trxName);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
throw e;
|
throw e;
|
||||||
} finally {
|
} finally{
|
||||||
try {
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null) pstmt.close ();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
} catch (Exception e) { pstmt = null; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -84,27 +84,24 @@ public class MEXPProcessor extends X_EXP_Processor {
|
||||||
.append(" AND IsActive = ?") // # 2
|
.append(" AND IsActive = ?") // # 2
|
||||||
//.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_)
|
//.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_)
|
||||||
;
|
;
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
X_EXP_ProcessorParameter processorParameter = null;
|
X_EXP_ProcessorParameter processorParameter = null;
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
||||||
pstmt.setInt(1, getEXP_Processor_ID());
|
pstmt.setInt(1, getEXP_Processor_ID());
|
||||||
pstmt.setString(2, "Y");
|
pstmt.setString(2, "Y");
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while ( rs.next() ) {
|
while ( rs.next() ) {
|
||||||
processorParameter = new X_EXP_ProcessorParameter (getCtx(), rs, trxName);
|
processorParameter = new X_EXP_ProcessorParameter (getCtx(), rs, trxName);
|
||||||
resultList.add(processorParameter);
|
resultList.add(processorParameter);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
} finally {
|
} finally{
|
||||||
try {
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null) pstmt.close ();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
} catch (Exception e) { pstmt = null; }
|
|
||||||
}
|
}
|
||||||
X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]);
|
X_EXP_ProcessorParameter[] result = (X_EXP_ProcessorParameter[])resultList.toArray( new X_EXP_ProcessorParameter[0]);
|
||||||
parameters = result;
|
parameters = result;
|
||||||
|
|
|
@ -70,11 +70,12 @@ public class MGLCategory extends X_GL_Category
|
||||||
String sql = "SELECT * FROM GL_Category "
|
String sql = "SELECT * FROM GL_Category "
|
||||||
+ "WHERE AD_Client_ID=? AND IsDefault='Y'";
|
+ "WHERE AD_Client_ID=? AND IsDefault='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
pstmt.setInt (1, Env.getAD_Client_ID(ctx));
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MGLCategory temp = new MGLCategory (ctx, rs, null);
|
MGLCategory temp = new MGLCategory (ctx, rs, null);
|
||||||
|
@ -86,22 +87,15 @@ public class MGLCategory extends X_GL_Category
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
retValue = temp;
|
retValue = temp;
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
|
@ -96,29 +96,23 @@ public class MIMPProcessor
|
||||||
+ "WHERE " + X_IMP_Processor.COLUMNNAME_IMP_Processor_ID + "=? " // # 1
|
+ "WHERE " + X_IMP_Processor.COLUMNNAME_IMP_Processor_ID + "=? " // # 1
|
||||||
+ "ORDER BY Created DESC";
|
+ "ORDER BY Created DESC";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getIMP_Processor_ID());
|
pstmt.setInt (1, getIMP_Processor_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MIMPProcessorLog (getCtx(), rs, get_TrxName()));
|
list.add (new MIMPProcessorLog (getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MIMPProcessorLog[] retValue = new MIMPProcessorLog[list.size ()];
|
MIMPProcessorLog[] retValue = new MIMPProcessorLog[list.size ()];
|
||||||
|
@ -156,26 +150,23 @@ public class MIMPProcessor
|
||||||
//.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_)
|
//.append(" ORDER BY ").append(X_EXP_ProcessorParameter.COLUMNNAME_)
|
||||||
;
|
;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
X_IMP_ProcessorParameter processorParameter = null;
|
X_IMP_ProcessorParameter processorParameter = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
pstmt = DB.prepareStatement (sql.toString(), trxName);
|
||||||
pstmt.setInt(1, getIMP_Processor_ID());
|
pstmt.setInt(1, getIMP_Processor_ID());
|
||||||
pstmt.setString(2, "Y");
|
pstmt.setString(2, "Y");
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while ( rs.next() ) {
|
while ( rs.next() ) {
|
||||||
processorParameter = new X_IMP_ProcessorParameter (getCtx(), rs, trxName);
|
processorParameter = new X_IMP_ProcessorParameter (getCtx(), rs, trxName);
|
||||||
resultList.add(processorParameter);
|
resultList.add(processorParameter);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
s_log.log(Level.SEVERE, sql.toString(), e);
|
s_log.log(Level.SEVERE, sql.toString(), e);
|
||||||
} finally {
|
} finally{
|
||||||
try {
|
DB.close(rs, pstmt);
|
||||||
if (pstmt != null) pstmt.close ();
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
} catch (Exception e) { pstmt = null; }
|
|
||||||
}
|
}
|
||||||
X_IMP_ProcessorParameter[] result = (X_IMP_ProcessorParameter[])resultList.toArray( new X_IMP_ProcessorParameter[0]);
|
X_IMP_ProcessorParameter[] result = (X_IMP_ProcessorParameter[])resultList.toArray( new X_IMP_ProcessorParameter[0]);
|
||||||
return result;
|
return result;
|
||||||
|
@ -186,28 +177,23 @@ public class MIMPProcessor
|
||||||
ArrayList<MIMPProcessor> list = new ArrayList<MIMPProcessor>();
|
ArrayList<MIMPProcessor> list = new ArrayList<MIMPProcessor>();
|
||||||
String sql = "SELECT * FROM "+X_IMP_Processor.Table_Name+" WHERE IsActive='Y'";
|
String sql = "SELECT * FROM "+X_IMP_Processor.Table_Name+" WHERE IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MIMPProcessor (ctx, rs, null));
|
list.add (new MIMPProcessor (ctx, rs, null));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,31 +54,25 @@ public class MInterestArea extends X_R_InterestArea
|
||||||
ArrayList<MInterestArea> list = new ArrayList<MInterestArea>();
|
ArrayList<MInterestArea> list = new ArrayList<MInterestArea>();
|
||||||
String sql = "SELECT * FROM R_InterestArea WHERE IsActive='Y'";
|
String sql = "SELECT * FROM R_InterestArea WHERE IsActive='Y'";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
MInterestArea ia = new MInterestArea (ctx, rs, null);
|
MInterestArea ia = new MInterestArea (ctx, rs, null);
|
||||||
list.add (ia);
|
list.add (ia);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MInterestArea[] retValue = new MInterestArea[list.size ()];
|
MInterestArea[] retValue = new MInterestArea[list.size ()];
|
||||||
|
|
|
@ -1112,9 +1112,6 @@ public class MInvoice extends X_C_Invoice implements DocAction
|
||||||
{
|
{
|
||||||
retValue = rs.getBigDecimal(1);
|
retValue = rs.getBigDecimal(1);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,31 +93,25 @@ public class MInvoiceBatch extends X_C_InvoiceBatch
|
||||||
String sql = "SELECT * FROM C_InvoiceBatchLine WHERE C_InvoiceBatch_ID=? ORDER BY Line";
|
String sql = "SELECT * FROM C_InvoiceBatchLine WHERE C_InvoiceBatch_ID=? ORDER BY Line";
|
||||||
ArrayList<MInvoiceBatchLine> list = new ArrayList<MInvoiceBatchLine>();
|
ArrayList<MInvoiceBatchLine> list = new ArrayList<MInvoiceBatchLine>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_InvoiceBatch_ID());
|
pstmt.setInt (1, getC_InvoiceBatch_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MInvoiceBatchLine (getCtx(), rs, get_TrxName()));
|
list.add (new MInvoiceBatchLine (getCtx(), rs, get_TrxName()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -726,16 +726,14 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
+ " LEFT OUTER JOIN C_Charge C ON (il.C_Charge_ID=c.C_Charge_ID) "
|
+ " LEFT OUTER JOIN C_Charge C ON (il.C_Charge_ID=c.C_Charge_ID) "
|
||||||
+ "WHERE C_InvoiceLine_ID=?";
|
+ "WHERE C_InvoiceLine_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getC_InvoiceLine_ID());
|
pstmt.setInt(1, getC_InvoiceLine_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
m_name = rs.getString(1);
|
m_name = rs.getString(1);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
if (m_name == null)
|
if (m_name == null)
|
||||||
m_name = "??";
|
m_name = "??";
|
||||||
}
|
}
|
||||||
|
@ -745,13 +743,8 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1238,19 +1231,17 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
if (whereClause != null)
|
if (whereClause != null)
|
||||||
sql += whereClause;
|
sql += whereClause;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getC_InvoiceLine_ID());
|
pstmt.setInt(1, getC_InvoiceLine_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
MLandedCost lc = new MLandedCost(getCtx(), rs, get_TrxName());
|
MLandedCost lc = new MLandedCost(getCtx(), rs, get_TrxName());
|
||||||
list.add(lc);
|
list.add(lc);
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -1258,13 +1249,8 @@ public class MInvoiceLine extends X_C_InvoiceLine
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
||||||
//
|
//
|
||||||
ArrayList<MInvoicePaySchedule> list = new ArrayList<MInvoicePaySchedule>();
|
ArrayList<MInvoicePaySchedule> list = new ArrayList<MInvoicePaySchedule>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql.toString(), trxName);
|
pstmt = DB.prepareStatement(sql.toString(), trxName);
|
||||||
|
@ -70,27 +71,20 @@ public class MInvoicePaySchedule extends X_C_InvoicePaySchedule
|
||||||
pstmt.setInt(1, C_Invoice_ID);
|
pstmt.setInt(1, C_Invoice_ID);
|
||||||
else
|
else
|
||||||
pstmt.setInt(1, C_InvoicePaySchedule_ID);
|
pstmt.setInt(1, C_InvoicePaySchedule_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
list.add (new MInvoicePaySchedule(ctx, rs, trxName));
|
list.add (new MInvoicePaySchedule(ctx, rs, trxName));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getInvoicePaySchedule", e);
|
s_log.log(Level.SEVERE, "getInvoicePaySchedule", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,29 +50,23 @@ public class MIssueProject extends X_R_IssueProject
|
||||||
MIssueProject pj = null;
|
MIssueProject pj = null;
|
||||||
String sql = "SELECT * FROM R_IssueProject WHERE Name=?";
|
String sql = "SELECT * FROM R_IssueProject WHERE Name=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setString (1, issue.getName());
|
pstmt.setString (1, issue.getName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
pj = new MIssueProject(issue.getCtx(), rs, null);
|
pj = new MIssueProject(issue.getCtx(), rs, null);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// New
|
// New
|
||||||
|
|
|
@ -47,31 +47,25 @@ public class MIssueSystem extends X_R_IssueSystem
|
||||||
if (issue.getDBAddress() == null)
|
if (issue.getDBAddress() == null)
|
||||||
return null;
|
return null;
|
||||||
MIssueSystem system = null;
|
MIssueSystem system = null;
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
String sql = "SELECT * FROM R_IssueSystem WHERE DBAddress=?";
|
String sql = "SELECT * FROM R_IssueSystem WHERE DBAddress=?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setString (1, issue.getDBAddress());
|
pstmt.setString (1, issue.getDBAddress());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
system = new MIssueSystem(issue.getCtx(), rs, null);
|
system = new MIssueSystem(issue.getCtx(), rs, null);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
// New
|
// New
|
||||||
|
|
|
@ -50,29 +50,23 @@ public class MIssueUser extends X_R_IssueUser
|
||||||
// Find Issue User
|
// Find Issue User
|
||||||
String sql = "SELECT * FROM R_IssueUser WHERE UserName=?";
|
String sql = "SELECT * FROM R_IssueUser WHERE UserName=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setString (1, issue.getUserName());
|
pstmt.setString (1, issue.getUserName());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
user = new MIssueUser (issue.getCtx(), rs, null);
|
user = new MIssueUser (issue.getCtx(), rs, null);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,30 +195,25 @@ public class MJournalBatch extends X_GL_JournalBatch implements DocAction
|
||||||
ArrayList<MJournal> list = new ArrayList<MJournal>();
|
ArrayList<MJournal> list = new ArrayList<MJournal>();
|
||||||
String sql = "SELECT * FROM GL_Journal WHERE GL_JournalBatch_ID=? ORDER BY DocumentNo";
|
String sql = "SELECT * FROM GL_Journal WHERE GL_JournalBatch_ID=? ORDER BY DocumentNo";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||||
pstmt.setInt(1, getGL_JournalBatch_ID());
|
pstmt.setInt(1, getGL_JournalBatch_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
list.add(new MJournal (getCtx(), rs, get_TrxName()));
|
list.add(new MJournal (getCtx(), rs, get_TrxName()));
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex)
|
catch (SQLException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, ex);
|
log.log(Level.SEVERE, sql, ex);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
DB.close(rs, pstmt);
|
||||||
pstmt.close();
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
}
|
}
|
||||||
catch (SQLException ex1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
pstmt = null;
|
|
||||||
//
|
//
|
||||||
MJournal[] retValue = new MJournal[list.size()];
|
MJournal[] retValue = new MJournal[list.size()];
|
||||||
list.toArray(retValue);
|
list.toArray(retValue);
|
||||||
|
|
|
@ -49,31 +49,25 @@ public class MLandedCost extends X_C_LandedCost
|
||||||
ArrayList<MLandedCost> list = new ArrayList<MLandedCost> ();
|
ArrayList<MLandedCost> list = new ArrayList<MLandedCost> ();
|
||||||
String sql = "SELECT * FROM C_LandedCost WHERE C_InvoiceLine_ID=?";
|
String sql = "SELECT * FROM C_LandedCost WHERE C_InvoiceLine_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, il.get_TrxName());
|
pstmt = DB.prepareStatement (sql, il.get_TrxName());
|
||||||
pstmt.setInt (1, il.getC_InvoiceLine_ID());
|
pstmt.setInt (1, il.getC_InvoiceLine_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MLandedCost (il.getCtx(), rs, il.get_TrxName()));
|
list.add (new MLandedCost (il.getCtx(), rs, il.get_TrxName()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -53,29 +53,23 @@ public class MLandedCostAllocation extends X_C_LandedCostAllocation
|
||||||
ArrayList<MLandedCostAllocation> list = new ArrayList<MLandedCostAllocation>();
|
ArrayList<MLandedCostAllocation> list = new ArrayList<MLandedCostAllocation>();
|
||||||
String sql = "SELECT * FROM C_LandedCostAllocation WHERE C_InvoiceLine_ID=?";
|
String sql = "SELECT * FROM C_LandedCostAllocation WHERE C_InvoiceLine_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
pstmt = DB.prepareStatement (sql, trxName);
|
||||||
pstmt.setInt (1, C_InvoiceLine_ID);
|
pstmt.setInt (1, C_InvoiceLine_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add (new MLandedCostAllocation (ctx, rs, trxName));
|
list.add (new MLandedCostAllocation (ctx, rs, trxName));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MLandedCostAllocation[] retValue = new MLandedCostAllocation[list.size ()];
|
MLandedCostAllocation[] retValue = new MLandedCostAllocation[list.size ()];
|
||||||
|
|
|
@ -101,21 +101,27 @@ public class MLocation extends X_C_Location implements Comparator<Object>
|
||||||
MLocation loc = null;
|
MLocation loc = null;
|
||||||
String sql = "SELECT * FROM C_Location l "
|
String sql = "SELECT * FROM C_Location l "
|
||||||
+ "WHERE C_Location_ID IN (SELECT C_Location_ID FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?)";
|
+ "WHERE C_Location_ID IN (SELECT C_Location_ID FROM C_BPartner_Location WHERE C_BPartner_Location_ID=?)";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
pstmt.setInt(1, C_BPartner_Location_ID);
|
pstmt.setInt(1, C_BPartner_Location_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
loc = new MLocation (ctx, rs, trxName);
|
loc = new MLocation (ctx, rs, trxName);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql + " - " + C_BPartner_Location_ID, e);
|
s_log.log(Level.SEVERE, sql + " - " + C_BPartner_Location_ID, e);
|
||||||
loc = null;
|
loc = null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return loc;
|
return loc;
|
||||||
} // getBPLocation
|
} // getBPLocation
|
||||||
|
|
||||||
|
|
|
@ -485,15 +485,17 @@ public final class MLookup extends Lookup implements Serializable
|
||||||
log.finer(m_info.KeyColumn + ": " + key
|
log.finer(m_info.KeyColumn + ": " + key
|
||||||
+ ", SaveInCache=" + saveInCache + ",Local=" + cacheLocal);
|
+ ", SaveInCache=" + saveInCache + ",Local=" + cacheLocal);
|
||||||
boolean isNumber = m_info.KeyColumn.endsWith("_ID");
|
boolean isNumber = m_info.KeyColumn.endsWith("_ID");
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// SELECT Key, Value, Name FROM ...
|
// SELECT Key, Value, Name FROM ...
|
||||||
PreparedStatement pstmt = DB.prepareStatement(m_info.QueryDirect, null);
|
pstmt = DB.prepareStatement(m_info.QueryDirect, null);
|
||||||
if (isNumber)
|
if (isNumber)
|
||||||
pstmt.setInt(1, Integer.parseInt(key.toString()));
|
pstmt.setInt(1, Integer.parseInt(key.toString()));
|
||||||
else
|
else
|
||||||
pstmt.setString(1, key.toString());
|
pstmt.setString(1, key.toString());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
String name = rs.getString(3);
|
String name = rs.getString(3);
|
||||||
|
@ -523,8 +525,6 @@ public final class MLookup extends Lookup implements Serializable
|
||||||
directValue = null;
|
directValue = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
if (CLogMgt.isLevelFinest())
|
if (CLogMgt.isLevelFinest())
|
||||||
log.finest(m_info.KeyColumn + ": " + directValue + " - " + m_info);
|
log.finest(m_info.KeyColumn + ": " + directValue + " - " + m_info);
|
||||||
}
|
}
|
||||||
|
@ -533,6 +533,12 @@ public final class MLookup extends Lookup implements Serializable
|
||||||
log.log(Level.SEVERE, m_info.KeyColumn + ": SQL=" + m_info.QueryDirect + "; Key=" + key, e);
|
log.log(Level.SEVERE, m_info.KeyColumn + ": SQL=" + m_info.QueryDirect + "; Key=" + key, e);
|
||||||
directValue = null;
|
directValue = null;
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
// Cache Local if not added to R/W cache
|
// Cache Local if not added to R/W cache
|
||||||
if (cacheLocal && !saveInCache && directValue != null)
|
if (cacheLocal && !saveInCache && directValue != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,11 +46,13 @@ public class MLookupInfo implements Serializable, Cloneable
|
||||||
int retValue = 0;
|
int retValue = 0;
|
||||||
String sql = "SELECT AD_Reference_ID,Name,ValidationType,IsActive "
|
String sql = "SELECT AD_Reference_ID,Name,ValidationType,IsActive "
|
||||||
+ "FROM AD_Reference WHERE Name LIKE ?";
|
+ "FROM AD_Reference WHERE Name LIKE ?";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, referenceName);
|
pstmt.setString(1, referenceName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
@ -69,13 +71,17 @@ public class MLookupInfo implements Serializable, Cloneable
|
||||||
"AD_Reference Name=").append(refName).append(", ID=").append(id).append(", Type=").append(validationType).append(", Active=").append(isActive);
|
"AD_Reference Name=").append(refName).append(", ID=").append(id).append(", Type=").append(validationType).append(", Active=").append(isActive);
|
||||||
CLogger.get().config(msgconf.toString());
|
CLogger.get().config(msgconf.toString());
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
CLogger.get().log(Level.SEVERE, sql, e);
|
CLogger.get().log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getAD_Reference_ID
|
} // getAD_Reference_ID
|
||||||
|
|
||||||
|
@ -92,11 +98,13 @@ public class MLookupInfo implements Serializable, Cloneable
|
||||||
String sql = "SELECT c.AD_Column_ID,c.ColumnName,t.TableName "
|
String sql = "SELECT c.AD_Column_ID,c.ColumnName,t.TableName "
|
||||||
+ "FROM AD_Column c, AD_Table t "
|
+ "FROM AD_Column c, AD_Table t "
|
||||||
+ "WHERE c.ColumnName LIKE ? AND c.AD_Table_ID=t.AD_Table_ID";
|
+ "WHERE c.ColumnName LIKE ? AND c.AD_Table_ID=t.AD_Table_ID";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, columnName);
|
pstmt.setString(1, columnName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
//
|
//
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
@ -112,13 +120,17 @@ public class MLookupInfo implements Serializable, Cloneable
|
||||||
StringBuilder msgconf = new StringBuilder("Name=").append(colName).append(", ID=").append(id).append(", Table=").append(tabName);
|
StringBuilder msgconf = new StringBuilder("Name=").append(colName).append(", ID=").append(id).append(", Table=").append(tabName);
|
||||||
CLogger.get().config(msgconf.toString());
|
CLogger.get().config(msgconf.toString());
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
CLogger.get().log(Level.SEVERE, sql, e);
|
CLogger.get().log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
|
pstmt = null;
|
||||||
|
}
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getAD_Column_ID
|
} // getAD_Column_ID
|
||||||
|
|
||||||
|
|
|
@ -339,13 +339,14 @@ public class MMailText extends X_R_MailText
|
||||||
{
|
{
|
||||||
MMailTextTrl trl = null;
|
MMailTextTrl trl = null;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
String sql = "SELECT * FROM R_MailText_Trl WHERE R_MailText_ID=? AND AD_Language=?";
|
String sql = "SELECT * FROM R_MailText_Trl WHERE R_MailText_ID=? AND AD_Language=?";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
pstmt.setInt (1, getR_MailText_ID());
|
pstmt.setInt (1, getR_MailText_ID());
|
||||||
pstmt.setString(2, AD_Language);
|
pstmt.setString(2, AD_Language);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
{
|
{
|
||||||
trl = new MMailTextTrl();
|
trl = new MMailTextTrl();
|
||||||
|
@ -355,24 +356,18 @@ public class MMailText extends X_R_MailText
|
||||||
trl.MailText2 = rs.getString("MailText2");
|
trl.MailText2 = rs.getString("MailText2");
|
||||||
trl.MailText3 = rs.getString("MailText3");
|
trl.MailText3 = rs.getString("MailText3");
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, sql, e);
|
log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return trl;
|
return trl;
|
||||||
} // getTranslation
|
} // getTranslation
|
||||||
|
|
||||||
|
|
|
@ -238,10 +238,11 @@ public class MMeasureCalc extends X_PA_MeasureCalc
|
||||||
// Execute
|
// Execute
|
||||||
StringBuilder where = new StringBuilder();
|
StringBuilder where = new StringBuilder();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (finalSQL, null);
|
pstmt = DB.prepareStatement (finalSQL, null);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
int id = rs.getInt(1);
|
int id = rs.getInt(1);
|
||||||
|
@ -249,22 +250,15 @@ public class MMeasureCalc extends X_PA_MeasureCalc
|
||||||
where.append(",");
|
where.append(",");
|
||||||
where.append(id);
|
where.append(id);
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log (Level.SEVERE, finalSQL, e);
|
log.log (Level.SEVERE, finalSQL, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (where.length() == 0)
|
if (where.length() == 0)
|
||||||
|
|
|
@ -50,32 +50,26 @@ public class MMedia extends X_CM_Media
|
||||||
{
|
{
|
||||||
ArrayList<MMedia> list = new ArrayList<MMedia>();
|
ArrayList<MMedia> list = new ArrayList<MMedia>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
String sql = "SELECT * FROM CM_Media WHERE CM_WebProject_ID=? ORDER BY CM_Media_ID";
|
String sql = "SELECT * FROM CM_Media WHERE CM_WebProject_ID=? ORDER BY CM_Media_ID";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, project.get_TrxName());
|
pstmt = DB.prepareStatement (sql, project.get_TrxName());
|
||||||
pstmt.setInt (1, project.getCM_WebProject_ID());
|
pstmt.setInt (1, project.getCM_WebProject_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MMedia (project.getCtx(), rs, project.get_TrxName()));
|
list.add (new MMedia (project.getCtx(), rs, project.get_TrxName()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MMedia[] retValue = new MMedia[list.size ()];
|
MMedia[] retValue = new MMedia[list.size ()];
|
||||||
|
|
|
@ -54,29 +54,23 @@ public class MMessage extends X_AD_Message
|
||||||
{
|
{
|
||||||
String sql = "SELECT * FROM AD_Message WHERE Value=?";
|
String sql = "SELECT * FROM AD_Message WHERE Value=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setString(1, Value);
|
pstmt.setString(1, Value);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
retValue = new MMessage (ctx, rs, null);
|
retValue = new MMessage (ctx, rs, null);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "get", e);
|
s_log.log(Level.SEVERE, "get", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
|
|
|
@ -146,29 +146,23 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction
|
||||||
+ "WHERE M_MovementConfirm_ID=?";
|
+ "WHERE M_MovementConfirm_ID=?";
|
||||||
ArrayList<MMovementLineConfirm> list = new ArrayList<MMovementLineConfirm>();
|
ArrayList<MMovementLineConfirm> list = new ArrayList<MMovementLineConfirm>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getM_MovementConfirm_ID());
|
pstmt.setInt (1, getM_MovementConfirm_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MMovementLineConfirm(getCtx(), rs, get_TrxName()));
|
list.add(new MMovementLineConfirm(getCtx(), rs, get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
m_lines = new MMovementLineConfirm[list.size ()];
|
m_lines = new MMovementLineConfirm[list.size ()];
|
||||||
|
|
|
@ -52,31 +52,25 @@ public class MMovementLineMA extends X_M_MovementLineMA
|
||||||
ArrayList<MMovementLineMA> list = new ArrayList<MMovementLineMA>();
|
ArrayList<MMovementLineMA> list = new ArrayList<MMovementLineMA>();
|
||||||
String sql = "SELECT * FROM M_MovementLineMA WHERE M_MovementLine_ID=?";
|
String sql = "SELECT * FROM M_MovementLineMA WHERE M_MovementLine_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
pstmt = DB.prepareStatement (sql, trxName);
|
||||||
pstmt.setInt (1, M_MovementLine_ID);
|
pstmt.setInt (1, M_MovementLine_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
list.add (new MMovementLineMA (ctx, rs, trxName));
|
list.add (new MMovementLineMA (ctx, rs, trxName));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,29 +75,23 @@ public class MNewsChannel extends X_CM_NewsChannel
|
||||||
sql += " AND " + where;
|
sql += " AND " + where;
|
||||||
sql += " ORDER BY pubDate DESC";
|
sql += " ORDER BY pubDate DESC";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, this.get_TrxName());
|
pstmt = DB.prepareStatement (sql, this.get_TrxName());
|
||||||
pstmt.setInt (1, this.get_ID());
|
pstmt.setInt (1, this.get_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
list.add(new MNewsItem(this.getCtx(), rs, this.get_TrxName()));
|
list.add(new MNewsItem(this.getCtx(), rs, this.get_TrxName()));
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, sql, e);
|
log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
MNewsItem[] retValue = new MNewsItem[list.size ()];
|
MNewsItem[] retValue = new MNewsItem[list.size ()];
|
||||||
|
|
|
@ -2698,15 +2698,22 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
List<MOrderLine> result = new Vector<MOrderLine>();
|
List<MOrderLine> result = new Vector<MOrderLine>();
|
||||||
Properties ctx = Env.getCtx();
|
Properties ctx = Env.getCtx();
|
||||||
MOrderLine line;
|
MOrderLine line;
|
||||||
PreparedStatement ps = conn.prepareStatement(OrderLinesToAllocate);
|
PreparedStatement ps = null;
|
||||||
ps.setInt(1, productId);
|
ResultSet rs = null;
|
||||||
ResultSet rs = ps.executeQuery();
|
try {
|
||||||
while(rs.next()) {
|
ps = conn.prepareStatement(OrderLinesToAllocate);
|
||||||
line = new MOrderLine(ctx, rs, trxName);
|
ps.setInt(1, productId);
|
||||||
result.add(line);
|
rs = ps.executeQuery();
|
||||||
|
while(rs.next()) {
|
||||||
|
line = new MOrderLine(ctx, rs, trxName);
|
||||||
|
result.add(line);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2735,23 +2742,28 @@ public class MOrder extends X_C_Order implements DocAction
|
||||||
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
"(QtyOrdered-QtyDelivered)>0 AND (QtyOrdered-QtyDelivered)>C_OrderLine.QtyAllocated)" +
|
||||||
"group by M_Product_ID " +
|
"group by M_Product_ID " +
|
||||||
"order by M_Product_ID";
|
"order by M_Product_ID";
|
||||||
|
PreparedStatement ps = null;
|
||||||
PreparedStatement ps = conn.prepareStatement(query1);
|
ResultSet rs = null;
|
||||||
ps.setInt(1, WarehouseID);
|
try {
|
||||||
ps.setInt(2, WarehouseID);
|
ps = conn.prepareStatement(query1);
|
||||||
ResultSet rs = ps.executeQuery();
|
ps.setInt(1, WarehouseID);
|
||||||
|
ps.setInt(2, WarehouseID);
|
||||||
while(rs.next()) {
|
rs = ps.executeQuery();
|
||||||
si = new StockInfo();
|
while(rs.next()) {
|
||||||
si.productId = rs.getInt(1);
|
si = new StockInfo();
|
||||||
si.qtyOnHand = rs.getBigDecimal(2);
|
si.productId = rs.getInt(1);
|
||||||
si.qtyReserved = rs.getBigDecimal(3);
|
si.qtyOnHand = rs.getBigDecimal(2);
|
||||||
si.qtyAvailable = si.qtyOnHand.subtract(si.qtyReserved);
|
si.qtyReserved = rs.getBigDecimal(3);
|
||||||
si.qtyAllocated = rs.getBigDecimal(4);
|
si.qtyAvailable = si.qtyOnHand.subtract(si.qtyReserved);
|
||||||
result.add(si);
|
si.qtyAllocated = rs.getBigDecimal(4);
|
||||||
|
result.add(si);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw e;
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, ps);
|
||||||
|
rs = null; ps = null;
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
sql += " AND M_AttributeSetInstance_ID=?";
|
sql += " AND M_AttributeSetInstance_ID=?";
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, null);
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
|
@ -90,25 +91,18 @@ public class MOrderLine extends X_C_OrderLine
|
||||||
pstmt.setInt (3, excludeC_OrderLine_ID);
|
pstmt.setInt (3, excludeC_OrderLine_ID);
|
||||||
if (M_AttributeSetInstance_ID != 0)
|
if (M_AttributeSetInstance_ID != 0)
|
||||||
pstmt.setInt (4, M_AttributeSetInstance_ID);
|
pstmt.setInt (4, M_AttributeSetInstance_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
retValue = rs.getBigDecimal(1);
|
retValue = rs.getBigDecimal(1);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
s_log.log (Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (retValue == null)
|
if (retValue == null)
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
||||||
//
|
//
|
||||||
ArrayList<MOrderPaySchedule> list = new ArrayList<MOrderPaySchedule>();
|
ArrayList<MOrderPaySchedule> list = new ArrayList<MOrderPaySchedule>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, trxName);
|
pstmt = DB.prepareStatement(sql, trxName);
|
||||||
|
@ -70,27 +71,20 @@ public class MOrderPaySchedule extends X_C_OrderPaySchedule
|
||||||
pstmt.setInt(1, C_Order_ID);
|
pstmt.setInt(1, C_Order_ID);
|
||||||
else
|
else
|
||||||
pstmt.setInt(1, C_OrderPaySchedule_ID);
|
pstmt.setInt(1, C_OrderPaySchedule_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
list.add (new MOrderPaySchedule(ctx, rs, trxName));
|
list.add (new MOrderPaySchedule(ctx, rs, trxName));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, "getOrderPaySchedule", e);
|
s_log.log(Level.SEVERE, "getOrderPaySchedule", e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,30 +77,24 @@ public class MOrderTax extends X_C_OrderTax
|
||||||
|
|
||||||
String sql = "SELECT * FROM C_OrderTax WHERE C_Order_ID=? AND C_Tax_ID=?";
|
String sql = "SELECT * FROM C_OrderTax WHERE C_Order_ID=? AND C_Tax_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
pstmt = DB.prepareStatement (sql, trxName);
|
||||||
pstmt.setInt (1, line.getC_Order_ID());
|
pstmt.setInt (1, line.getC_Order_ID());
|
||||||
pstmt.setInt (2, C_Tax_ID);
|
pstmt.setInt (2, C_Tax_ID);
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
if (rs.next ())
|
if (rs.next ())
|
||||||
retValue = new MOrderTax (line.getCtx(), rs, trxName);
|
retValue = new MOrderTax (line.getCtx(), rs, trxName);
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
s_log.log(Level.SEVERE, sql, e);
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
if (retValue != null)
|
if (retValue != null)
|
||||||
|
@ -212,12 +206,13 @@ public class MOrderTax extends X_C_OrderTax
|
||||||
//
|
//
|
||||||
String sql = "SELECT LineNetAmt FROM C_OrderLine WHERE C_Order_ID=? AND C_Tax_ID=?";
|
String sql = "SELECT LineNetAmt FROM C_OrderLine WHERE C_Order_ID=? AND C_Tax_ID=?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||||
pstmt.setInt (1, getC_Order_ID());
|
pstmt.setInt (1, getC_Order_ID());
|
||||||
pstmt.setInt (2, getC_Tax_ID());
|
pstmt.setInt (2, getC_Tax_ID());
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
rs = pstmt.executeQuery ();
|
||||||
while (rs.next ())
|
while (rs.next ())
|
||||||
{
|
{
|
||||||
BigDecimal baseAmt = rs.getBigDecimal(1);
|
BigDecimal baseAmt = rs.getBigDecimal(1);
|
||||||
|
@ -226,23 +221,16 @@ public class MOrderTax extends X_C_OrderTax
|
||||||
if (!documentLevel) // calculate line tax
|
if (!documentLevel) // calculate line tax
|
||||||
taxAmt = taxAmt.add(tax.calculateTax(baseAmt, isTaxIncluded(), getPrecision()));
|
taxAmt = taxAmt.add(tax.calculateTax(baseAmt, isTaxIncluded(), getPrecision()));
|
||||||
}
|
}
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, get_TrxName(), e);
|
log.log(Level.SEVERE, get_TrxName(), e);
|
||||||
taxBaseAmt = null;
|
taxBaseAmt = null;
|
||||||
}
|
}
|
||||||
try
|
finally
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
rs = null;
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -152,18 +152,16 @@ public class MPInstance extends X_AD_PInstance
|
||||||
m_log.clear();
|
m_log.clear();
|
||||||
String sql = "SELECT * FROM AD_PInstance_Log WHERE AD_PInstance_ID=? ORDER BY Log_ID";
|
String sql = "SELECT * FROM AD_PInstance_Log WHERE AD_PInstance_ID=? ORDER BY Log_ID";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, getAD_PInstance_ID());
|
pstmt.setInt(1, getAD_PInstance_ID());
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
m_log.add(new MPInstanceLog(rs));
|
m_log.add(new MPInstanceLog(rs));
|
||||||
}
|
}
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -171,16 +169,10 @@ public class MPInstance extends X_AD_PInstance
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
try
|
DB.close(rs, pstmt);
|
||||||
{
|
rs = null;
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPInstanceLog[] retValue = new MPInstanceLog[m_log.size()];
|
MPInstanceLog[] retValue = new MPInstanceLog[m_log.size()];
|
||||||
m_log.toArray(retValue);
|
m_log.toArray(retValue);
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue