[ 2624860 ] MCost not updated in transaction

https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2624860&group_id=176962
This commit is contained in:
teo_sarca 2009-02-21 19:16:01 +00:00
parent d5b1984d6a
commit 32dfedf741
2 changed files with 16 additions and 9 deletions

View File

@ -680,7 +680,7 @@ public class MCost extends X_M_Cost
for(MCostElement ce : ces) for(MCostElement ce : ces)
{ {
MCost cost = MCost.get (product, M_ASI_ID, MCost cost = MCost.get (product, M_ASI_ID,
as, 0, ce.getM_CostElement_ID()); as, 0, ce.getM_CostElement_ID(), product.get_TrxName());
if (cost.is_new()) if (cost.is_new())
{ {
if (cost.save()) if (cost.save())
@ -701,7 +701,7 @@ public class MCost extends X_M_Cost
for(MCostElement ce : ces) for(MCostElement ce : ces)
{ {
MCost cost = MCost.get (product, M_ASI_ID, MCost cost = MCost.get (product, M_ASI_ID,
as, o.getAD_Org_ID(), ce.getM_CostElement_ID()); as, o.getAD_Org_ID(), ce.getM_CostElement_ID(), product.get_TrxName());
if (cost.is_new()) if (cost.is_new())
{ {
if (cost.save()) if (cost.save())
@ -748,7 +748,7 @@ public class MCost extends X_M_Cost
for(MCostElement ce : ces) for(MCostElement ce : ces)
{ {
MCost cost = MCost.get (product, M_ASI_ID, MCost cost = MCost.get (product, M_ASI_ID,
as, 0, ce.getM_CostElement_ID()); as, 0, ce.getM_CostElement_ID(), product.get_TrxName());
if(cost != null) if(cost != null)
cost.deleteEx(true); cost.deleteEx(true);
} }
@ -762,7 +762,7 @@ public class MCost extends X_M_Cost
for(MCostElement ce : ces) for(MCostElement ce : ces)
{ {
MCost cost = MCost.get (product, M_ASI_ID, MCost cost = MCost.get (product, M_ASI_ID,
as, o.getAD_Org_ID(), ce.getM_CostElement_ID()); as, o.getAD_Org_ID(), ce.getM_CostElement_ID(), product.get_TrxName());
if(cost != null) if(cost != null)
cost.deleteEx(true); cost.deleteEx(true);
} }
@ -1266,7 +1266,7 @@ public class MCost extends X_M_Cost
* @return cost price or null * @return cost price or null
*/ */
public static MCost get (MProduct product, int M_AttributeSetInstance_ID, public static MCost get (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID, int M_CostElement_ID) MAcctSchema as, int AD_Org_ID, int M_CostElement_ID, String trxName)
{ {
MCost cost = null; MCost cost = null;
//FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
@ -1275,7 +1275,7 @@ public class MCost extends X_M_Cost
+ " AND M_AttributeSetInstance_ID=?" + " AND M_AttributeSetInstance_ID=?"
+ " AND M_CostType_ID=? AND C_AcctSchema_ID=?" + " AND M_CostType_ID=? AND C_AcctSchema_ID=?"
+ " AND M_CostElement_ID=?"; + " AND M_CostElement_ID=?";
cost = new Query(product.getCtx(), MCost.Table_Name, whereClause, product.get_TrxName()) cost = new Query(product.getCtx(), MCost.Table_Name, whereClause, trxName)
.setParameters(new Object[]{ .setParameters(new Object[]{
product.getAD_Client_ID(), product.getAD_Client_ID(),
AD_Org_ID, AD_Org_ID,
@ -1292,7 +1292,14 @@ public class MCost extends X_M_Cost
as, AD_Org_ID, M_CostElement_ID); as, AD_Org_ID, M_CostElement_ID);
return cost; return cost;
} // get } // get
@Deprecated
public static MCost get (MProduct product, int M_AttributeSetInstance_ID,
MAcctSchema as, int AD_Org_ID, int M_CostElement_ID)
{
return get(product, M_AttributeSetInstance_ID, as, AD_Org_ID, M_CostElement_ID, product.get_TrxName());
}
/** /**
* Get Cost Record * Get Cost Record
* @param ctx context * @param ctx context

View File

@ -762,7 +762,7 @@ public class MCostDetail extends X_M_CostDetail
boolean ok = false; boolean ok = false;
// get costing level for product // get costing level for product
MAcctSchema as = new MAcctSchema (getCtx(), getC_AcctSchema_ID(), null); MAcctSchema as = MAcctSchema.get(getCtx(), getC_AcctSchema_ID());
MProduct product = MProduct.get(getCtx(), getM_Product_ID()); MProduct product = MProduct.get(getCtx(), getM_Product_ID());
String CostingLevel = product.getCostingLevel(as); String CostingLevel = product.getCostingLevel(as);
// Org Element // Org Element
@ -821,7 +821,7 @@ public class MCostDetail extends X_M_CostDetail
int Org_ID, int M_ASI_ID) int Org_ID, int M_ASI_ID)
{ {
MCost cost = MCost.get(product, M_ASI_ID, as, MCost cost = MCost.get(product, M_ASI_ID, as,
Org_ID, ce.getM_CostElement_ID()); Org_ID, ce.getM_CostElement_ID(), get_TrxName());
// if (cost == null) // if (cost == null)
// cost = new MCost(product, M_ASI_ID, // cost = new MCost(product, M_ASI_ID,
// as, Org_ID, ce.getM_CostElement_ID()); // as, Org_ID, ce.getM_CostElement_ID());