FR: [ 2214883 ] Remove SQL code and Replace for Query

-- JUnit test in next commit (no failures)
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Redhuan D. Oon 2010-03-20 09:50:22 +00:00
parent 07994b0b88
commit 1175c2cab5
1 changed files with 6 additions and 32 deletions

View File

@ -44,6 +44,7 @@ import org.compiere.util.Msg;
* <li>BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or * <li>BF [ 1733602 ] Price List including Tax Error - when a user changes the orderline or
* invoice line for a product on a price list that includes tax, the net amount is * invoice line for a product on a price list that includes tax, the net amount is
* incorrectly calculated. * incorrectly calculated.
* @author red1 FR: [ 2214883 ] Remove SQL code and Replace for Query
*/ */
public class MInvoiceLine extends X_C_InvoiceLine public class MInvoiceLine extends X_C_InvoiceLine
{ {
@ -63,38 +64,11 @@ public class MInvoiceLine extends X_C_InvoiceLine
{ {
if (sLine == null) if (sLine == null)
return null; return null;
MInvoiceLine retValue = null; final String whereClause = I_M_InOutLine.COLUMNNAME_M_InOutLine_ID+"=?";
String sql = "SELECT * FROM C_InvoiceLine WHERE M_InOutLine_ID=?"; MInvoiceLine retValue = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName())
PreparedStatement pstmt = null; .setParameters(sLine.getM_InOutLine_ID())
try .firstOnly();
{
pstmt = DB.prepareStatement (sql, sLine.get_TrxName());
pstmt.setInt (1, sLine.getM_InOutLine_ID());
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
{
retValue = new MInvoiceLine (sLine.getCtx(), rs, sLine.get_TrxName());
if (rs.next())
s_log.warning("More than one C_InvoiceLine of " + sLine);
}
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log(Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return retValue; return retValue;
} // getOfInOutLine } // getOfInOutLine