Libero QA:

LiberoValidator - fix intendation
MPPMRP.C_OrderLine - fix SQL boolean logic; Victor, please ALWAYS use brackets when write boolean logic
This commit is contained in:
teo_sarca 2009-01-13 13:08:46 +00:00
parent 9227c53c4f
commit 67d8427774
2 changed files with 45 additions and 49 deletions

View File

@ -181,55 +181,54 @@ public class LiberoValidator implements ModelValidator
MInOut inout = (MInOut)po;
if(inout.isSOTrx())
{
final String whereClause = "C_OrderLine_ID IS NOT NULL AND EXISTS ( SELECT 1 FROM C_OrderLine ol , M_InOutLine iol WHERE ol.C_OrderLine_ID=iol.C_OrderLine_ID AND iol.M_InOut_ID=? )";
Collection<MPPOrder> orders = new Query(po.getCtx(), MPPOrder.Table_Name, whereClause, po.get_TrxName())
.setParameters(new Object[]{inout.getM_InOut_ID()})
.list();
for(MPPOrder order : orders)
{
String description = order.getDescription() != null ? order.getDescription() : ""
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_M_InOut_ID)
+ " : "
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_DocumentNo);
order.setDescription(description);
order.closeIt();
order.setDocStatus(MPPOrder.DOCACTION_Close);
order.setDocAction(MPPOrder.DOCACTION_None);
order.saveEx();
}
}
}
else
{
final String whereClause = "C_OrderLine_ID IS NOT NULL"
+" AND EXISTS (SELECT 1 FROM C_OrderLine ol , M_InOutLine iol"
+" WHERE ol.C_OrderLine_ID=iol.C_OrderLine_ID AND iol.M_InOut_ID=? )";
Collection<MPPOrder> orders = new Query(po.getCtx(), MPPOrder.Table_Name, whereClause, po.get_TrxName())
.setParameters(new Object[]{inout.getM_InOut_ID()})
.list();
for(MPPOrder order : orders)
{
String description = order.getDescription() != null ? order.getDescription() : ""
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_M_InOut_ID)
+ " : "
+ Msg.translate(inout.getCtx(), MInOut.COLUMNNAME_DocumentNo);
order.setDescription(description);
order.closeIt();
order.setDocStatus(MPPOrder.DOCACTION_Close);
order.setDocAction(MPPOrder.DOCACTION_None);
order.saveEx();
}
}
}
if (po instanceof MInOut && timing == TIMING_AFTER_COMPLETE)
else if (po instanceof MInOut && timing == TIMING_AFTER_COMPLETE)
{
MInOut inout = (MInOut)po;
for (MInOutLine line : inout.getLines())
for (MInOutLine line : inout.getLines())
{
final String whereClause = "C_OrderLine_ID=? AND PP_Cost_Collector_ID IS NOT NULL";
Collection<MOrderLine> olines = new Query(po.getCtx(), MOrderLine.Table_Name, whereClause, po.get_TrxName())
.setParameters(new Object[]{line.getC_OrderLine_ID()})
.list();
for (MOrderLine oline : olines)
{
final String whereClause = "C_OrderLine_ID=? AND PP_Cost_Collector_ID IS NOT NULL";
Collection<MOrderLine> olines = new Query(po.getCtx(), MOrderLine.Table_Name, whereClause, po.get_TrxName())
.setParameters(new Object[]{line.getC_OrderLine_ID()})
.list();
for (MOrderLine oline : olines)
{
if(oline.getQtyOrdered().compareTo(oline.getQtyDelivered()) >= 0)
{
MPPCostCollector cc = new MPPCostCollector(po.getCtx(), oline.getPP_Cost_Collector_ID(), po.get_TrxName());
String docStatus = cc.completeIt();
cc.setDocStatus(docStatus);
cc.setDocAction(MPPCostCollector.DOCACTION_Close);
cc.saveEx();
return Msg.translate(po.getCtx(), "PP_Order_ID")
+":"+cc.getPP_Order().getDocumentNo()
+Msg.translate(po.getCtx(),"PP_Order_Node_ID")
+":"+cc.getPP_Order_Node().getValue();
}
if(oline.getQtyOrdered().compareTo(oline.getQtyDelivered()) >= 0)
{
MPPCostCollector cc = new MPPCostCollector(po.getCtx(), oline.getPP_Cost_Collector_ID(), po.get_TrxName());
String docStatus = cc.completeIt();
cc.setDocStatus(docStatus);
cc.setDocAction(MPPCostCollector.DOCACTION_Close);
cc.saveEx();
return Msg.translate(po.getCtx(), "PP_Order_ID")
+":"+cc.getPP_Order().getDocumentNo()
+Msg.translate(po.getCtx(),"PP_Order_Node_ID")
+":"+cc.getPP_Order_Node().getValue();
}
}
}
}
return null;
} // docValidate

View File

@ -369,8 +369,7 @@ public class MPPMRP extends X_PP_MRP
MPPOrder order = MPPOrder.forC_OrderLine_ID(ol.getCtx(), ol.get_ID(), ol.get_TrxName());
if (order == null)
{
final String whereClause = MPPProductBOM.COLUMNNAME_BOMType+"=? "
+" OR "+MPPProductBOM.COLUMNNAME_BOMType+"=? "
final String whereClause = MPPProductBOM.COLUMNNAME_BOMType+" IN (?,?)"
+" AND "+MPPProductBOM.COLUMNNAME_BOMUse+"=?"
+" AND "+MPPProductBOM.COLUMNNAME_M_Product_ID+"=?";
MPPProductBOM bom = new Query(ol.getCtx(), MPPProductBOM.Table_Name, whereClause, null)
@ -389,11 +388,9 @@ public class MPPMRP extends X_PP_MRP
if(pp != null)
{
bom = (MPPProductBOM) pp.getPP_Product_BOM();
if(bom != null && !MPPProductBOM.BOMTYPE_Make_To_Order.equals(bom.getBOMType()))
{
bom = null;
}
if(bom != null && !MPPProductBOM.BOMTYPE_Make_To_Kit.equals(bom.getBOMType()))
if( bom != null
&& !MPPProductBOM.BOMTYPE_Make_To_Order.equals(bom.getBOMType())
&& !MPPProductBOM.BOMTYPE_Make_To_Kit.equals(bom.getBOMType()) )
{
bom = null;
}