libero: MPPProductPlanning : more field validation

Victor, please help me on this talk, to define more validations
This commit is contained in:
teo_sarca 2009-02-03 07:35:33 +00:00
parent 060ff39708
commit e81be62d56
1 changed files with 22 additions and 0 deletions

View File

@ -180,6 +180,13 @@ public class MPPProductPlanning extends X_PP_Product_Planning
@Override @Override
protected boolean beforeSave(boolean newRecord) protected boolean beforeSave(boolean newRecord)
{ {
//
// Set default : Order_Policy
if (getOrder_Policy() == null)
{
setOrder_Policy(ORDER_POLICY_LoteForLote);
}
//
// Check Order_Min < Order_Max // Check Order_Min < Order_Max
if (getOrder_Min().signum() > 0 if (getOrder_Min().signum() > 0
&& getOrder_Max().signum() > 0 && getOrder_Max().signum() > 0
@ -187,6 +194,21 @@ public class MPPProductPlanning extends X_PP_Product_Planning
{ {
throw new AdempiereException("@Order_Min@ > @Order_Max@"); throw new AdempiereException("@Order_Min@ > @Order_Max@");
} }
//
// Check Order_Period
if (ORDER_POLICY_PeriodOrderQuantity.equals(getOrder_Policy())
&& getOrder_Period().signum() <= 0)
{
throw new AdempiereException("@Order_Period@ <= 0");
}
//
// Check Order_Qty
if (ORDER_POLICY_FixedOrderQuantity.equals(getOrder_Policy())
&& getOrder_Qty().signum() <= 0)
{
throw new AdempiereException("@Order_Qty@ <= 0");
}
//
return true; return true;
} }