Fix [ 1890206 ] getLines without reload not assigning trx

Implement suggestion from Teo
This commit is contained in:
Carlos Ruiz 2008-02-09 17:23:00 +00:00
parent b5b8dacf92
commit 232f2c383c
20 changed files with 68 additions and 20 deletions

View File

@ -199,8 +199,12 @@ public final class MAllocationHdr extends X_C_AllocationHdr implements DocAction
*/ */
public MAllocationLine[] getLines (boolean requery) public MAllocationLine[] getLines (boolean requery)
{ {
if (m_lines != null && m_lines.length != 0 && !requery) if (m_lines != null && m_lines.length != 0 && !requery) {
return m_lines; if (m_lines != null && m_lines.length != 0 && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines;
}
}
// //
String sql = "SELECT * FROM C_AllocationLine WHERE C_AllocationHdr_ID=?"; String sql = "SELECT * FROM C_AllocationLine WHERE C_AllocationHdr_ID=?";
ArrayList<MAllocationLine> list = new ArrayList<MAllocationLine>(); ArrayList<MAllocationLine> list = new ArrayList<MAllocationLine>();

View File

@ -103,8 +103,10 @@ public class MBankStatement extends X_C_BankStatement implements DocAction
*/ */
public MBankStatementLine[] getLines (boolean requery) public MBankStatementLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
ArrayList<MBankStatementLine> list = new ArrayList<MBankStatementLine>(); ArrayList<MBankStatementLine> list = new ArrayList<MBankStatementLine>();
String sql = "SELECT * FROM C_BankStatementLine " String sql = "SELECT * FROM C_BankStatementLine "

View File

@ -239,8 +239,10 @@ public class MCash extends X_C_Cash implements DocAction
*/ */
public MCashLine[] getLines (boolean requery) public MCashLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MCashLine> list = new ArrayList<MCashLine>(); ArrayList<MCashLine> list = new ArrayList<MCashLine>();
String sql = "SELECT * FROM C_CashLine WHERE C_Cash_ID=? ORDER BY Line"; String sql = "SELECT * FROM C_CashLine WHERE C_Cash_ID=? ORDER BY Line";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;

View File

@ -140,8 +140,10 @@ public class MDiscountSchema extends X_M_DiscountSchema
*/ */
public MDiscountSchemaLine[] getLines(boolean reload) public MDiscountSchemaLine[] getLines(boolean reload)
{ {
if (m_lines != null && !reload) if (m_lines != null && !reload) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
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>();

View File

@ -243,8 +243,10 @@ public class MDistribution extends X_GL_Distribution
*/ */
public MDistributionLine[] getLines (boolean reload) public MDistributionLine[] getLines (boolean reload)
{ {
if (m_lines != null && !reload) if (m_lines != null && !reload) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
BigDecimal PercentTotal = Env.ZERO; BigDecimal PercentTotal = Env.ZERO;
ArrayList<MDistributionLine> list = new ArrayList<MDistributionLine>(); ArrayList<MDistributionLine> list = new ArrayList<MDistributionLine>();

View File

@ -62,8 +62,10 @@ public class MDistributionRun extends X_M_DistributionRun
*/ */
public MDistributionRunLine[] getLines (boolean reload) public MDistributionRunLine[] getLines (boolean reload)
{ {
if (!reload && m_lines != null) if (!reload && m_lines != null) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
String sql = "SELECT * FROM M_DistributionRunLine " String sql = "SELECT * FROM M_DistributionRunLine "
+ "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";

View File

@ -540,8 +540,10 @@ public class MInOut extends X_M_InOut implements DocAction
*/ */
public MInOutLine[] getLines (boolean requery) public MInOutLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MInOutLine> list = new ArrayList<MInOutLine>(); ArrayList<MInOutLine> list = new ArrayList<MInOutLine>();
String sql = "SELECT * FROM M_InOutLine WHERE M_InOut_ID=? ORDER BY Line"; String sql = "SELECT * FROM M_InOutLine WHERE M_InOut_ID=? ORDER BY Line";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;

View File

@ -131,8 +131,10 @@ public class MInOutConfirm extends X_M_InOutConfirm implements DocAction
*/ */
public MInOutLineConfirm[] getLines (boolean requery) public MInOutLineConfirm[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
String sql = "SELECT * FROM M_InOutLineConfirm " String sql = "SELECT * FROM M_InOutLineConfirm "
+ "WHERE M_InOutConfirm_ID=?"; + "WHERE M_InOutConfirm_ID=?";
ArrayList<MInOutLineConfirm> list = new ArrayList<MInOutLineConfirm>(); ArrayList<MInOutLineConfirm> list = new ArrayList<MInOutLineConfirm>();

View File

@ -110,8 +110,10 @@ public class MInventory extends X_M_Inventory implements DocAction
*/ */
public MInventoryLine[] getLines (boolean requery) public MInventoryLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
ArrayList<MInventoryLine> list = new ArrayList<MInventoryLine>(); ArrayList<MInventoryLine> list = new ArrayList<MInventoryLine>();
String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? ORDER BY Line"; String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? ORDER BY Line";

View File

@ -639,6 +639,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
{ {
if (m_lines == null || m_lines.length == 0 || requery) if (m_lines == null || m_lines.length == 0 || requery)
m_lines = getLines(null); m_lines = getLines(null);
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
} // getLines } // getLines

View File

@ -75,8 +75,10 @@ public class MInvoiceBatch extends X_C_InvoiceBatch
*/ */
public MInvoiceBatchLine[] getLines (boolean reload) public MInvoiceBatchLine[] getLines (boolean reload)
{ {
if (m_lines != null && !reload) if (m_lines != null && !reload) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
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;

View File

@ -77,8 +77,10 @@ public class MMovement extends X_M_Movement implements DocAction
*/ */
public MMovementLine[] getLines (boolean requery) public MMovementLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
ArrayList<MMovementLine> list = new ArrayList<MMovementLine>(); ArrayList<MMovementLine> list = new ArrayList<MMovementLine>();
String sql = "SELECT * FROM M_MovementLine WHERE M_Movement_ID=? ORDER BY Line"; String sql = "SELECT * FROM M_MovementLine WHERE M_Movement_ID=? ORDER BY Line";

View File

@ -122,8 +122,10 @@ public class MMovementConfirm extends X_M_MovementConfirm implements DocAction
*/ */
public MMovementLineConfirm[] getLines (boolean requery) public MMovementLineConfirm[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
String sql = "SELECT * FROM M_MovementLineConfirm " String sql = "SELECT * FROM M_MovementLineConfirm "
+ "WHERE M_MovementConfirm_ID=?"; + "WHERE M_MovementConfirm_ID=?";
ArrayList<MMovementLineConfirm> list = new ArrayList<MMovementLineConfirm>(); ArrayList<MMovementLineConfirm> list = new ArrayList<MMovementLineConfirm>();

View File

@ -645,8 +645,10 @@ public class MOrder extends X_C_Order implements DocAction
*/ */
public MOrderLine[] getLines (boolean requery, String orderBy) public MOrderLine[] getLines (boolean requery, String orderBy)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
String orderClause = "ORDER BY "; String orderClause = "ORDER BY ";
if (orderBy != null && orderBy.length() > 0) if (orderBy != null && orderBy.length() > 0)

View File

@ -73,8 +73,10 @@ public class MPaySelection extends X_C_PaySelection
*/ */
public MPaySelectionLine[] getLines(boolean requery) public MPaySelectionLine[] getLines(boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MPaySelectionLine> list = new ArrayList<MPaySelectionLine>(); ArrayList<MPaySelectionLine> list = new ArrayList<MPaySelectionLine>();
String sql = "SELECT * FROM C_PaySelectionLine WHERE C_PaySelection_ID=? ORDER BY Line"; String sql = "SELECT * FROM C_PaySelectionLine WHERE C_PaySelection_ID=? ORDER BY Line";
PreparedStatement pstmt = null; PreparedStatement pstmt = null;

View File

@ -79,8 +79,10 @@ public class MRMA extends X_M_RMA implements DocAction
*/ */
public MRMALine[] getLines (boolean requery) public MRMALine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MRMALine> list = new ArrayList<MRMALine>(); ArrayList<MRMALine> list = new ArrayList<MRMALine>();
String sql = "SELECT * FROM M_RMALine WHERE M_RMA_ID=?"; String sql = "SELECT * FROM M_RMALine WHERE M_RMA_ID=?";

View File

@ -77,8 +77,10 @@ public class MRequisition extends X_M_Requisition implements DocAction
*/ */
public MRequisitionLine[] getLines() public MRequisitionLine[] getLines()
{ {
if (m_lines != null) if (m_lines != null) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MRequisitionLine> list = new ArrayList<MRequisitionLine>(); ArrayList<MRequisitionLine> list = new ArrayList<MRequisitionLine>();
String sql = "SELECT * FROM M_RequisitionLine WHERE M_Requisition_ID=? ORDER BY Line"; String sql = "SELECT * FROM M_RequisitionLine WHERE M_Requisition_ID=? ORDER BY Line";

View File

@ -147,8 +147,10 @@ public class MRfQResponse extends X_C_RfQResponse
*/ */
public MRfQResponseLine[] getLines(boolean requery) public MRfQResponseLine[] getLines(boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
ArrayList<MRfQResponseLine> list = new ArrayList<MRfQResponseLine>(); ArrayList<MRfQResponseLine> list = new ArrayList<MRfQResponseLine>();
String sql = "SELECT * FROM C_RfQResponseLine " String sql = "SELECT * FROM C_RfQResponseLine "
+ "WHERE C_RfQResponse_ID=? AND IsActive='Y'"; + "WHERE C_RfQResponse_ID=? AND IsActive='Y'";

View File

@ -89,8 +89,10 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
*/ */
public MTimeExpenseLine[] getLines (boolean requery) public MTimeExpenseLine[] getLines (boolean requery)
{ {
if (m_lines != null && !requery) if (m_lines != null && !requery) {
set_TrxName(m_lines, get_TrxName());
return m_lines; return m_lines;
}
// //
int C_Currency_ID = getC_Currency_ID(); int C_Currency_ID = getC_Currency_ID();
ArrayList<MTimeExpenseLine> list = new ArrayList<MTimeExpenseLine>(); ArrayList<MTimeExpenseLine> list = new ArrayList<MTimeExpenseLine>();

View File

@ -3586,6 +3586,15 @@ public abstract class PO
*/ */
public Doc getDoc() { public Doc getDoc() {
return m_doc; return m_doc;
} }
/**
* PO.setTrxName - set given trxName to an array of POs
* As suggested by teo in [ 1854603 ]
*/
public static void set_TrxName(PO[] lines, String trxName) {
for (PO line : lines)
line.set_TrxName(trxName);
}
} // PO } // PO