New sample of GardenWorld MyValidator to work correctly with new events
This commit is contained in:
parent
ada57fd26c
commit
501eca17d5
|
@ -57,9 +57,12 @@ public class MyValidator implements ModelValidator
|
|||
log.info(client.toString());
|
||||
|
||||
// We want to be informed when C_Order is created/changed
|
||||
engine.addModelChange("C_Order", this);
|
||||
engine.addModelChange(MOrder.Table_Name, this);
|
||||
// We want to validate Order before preparing
|
||||
engine.addDocValidate("C_Order", this);
|
||||
engine.addDocValidate(MOrder.Table_Name, this);
|
||||
engine.addDocValidate(MInOut.Table_Name, this);
|
||||
engine.addDocValidate(MPayment.Table_Name, this);
|
||||
engine.addDocValidate(MCash.Table_Name, this);
|
||||
} // initialize
|
||||
|
||||
/**
|
||||
|
@ -92,10 +95,12 @@ public class MyValidator implements ModelValidator
|
|||
*/
|
||||
public String docValidate (PO po, int timing)
|
||||
{
|
||||
log.info(po.get_TableName() + " Timing: "+timing);
|
||||
// Ignore all after Complete events
|
||||
if (timing == TIMING_AFTER_COMPLETE)
|
||||
return null;
|
||||
// TIMING_BEFORE_PREPARE
|
||||
|
||||
if (timing == TIMING_BEFORE_PREPARE) {
|
||||
if (po.get_TableName().equals(MOrder.Table_Name))
|
||||
{
|
||||
/** Order Discount Example *
|
||||
|
@ -106,6 +111,8 @@ public class MyValidator implements ModelValidator
|
|||
/** Order Discount Example */
|
||||
log.info(po.toString());
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} // docValidate
|
||||
|
||||
|
|
Loading…
Reference in New Issue