Quintiq file version 2.0
|
#parent: #root
|
StaticMethod ValidateInput (
|
output String feedback_o,
|
MacroPlan macroplan,
|
SalesSegment_MP salessegment,
|
StockingPoint_MP stockingpoint,
|
ProductInStockingPoint_MP product,
|
Date start,
|
Date end,
|
Currency_MP currency,
|
Real quantity,
|
Real adjustment,
|
Real price,
|
Priority priority,
|
String type
|
) declarative remote as Boolean
|
{
|
Description: 'Validate user input from dialog'
|
TextBody:
|
[*
|
feedback_o := ''
|
gp := macroplan.GlobalParameters_MP();
|
|
// CHeck if sales segment is null
|
if( isnull( salessegment ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNullSalesSegment( type );
|
}
|
// Check if stocking point is null
|
else if( isnull( stockingpoint ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNullStockingPoint( type );
|
}
|
// Check if product is null
|
else if( isnull( product ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNullProduct( type );
|
}
|
// Check if adjustment is valid
|
else if( adjustment < -100.0 )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNegativeAdjustment( adjustment );
|
}
|
// Check if quantity is valid
|
else if( quantity < 0.0 )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNegativeQuantity( quantity );
|
}
|
// Check if quantity is within range
|
else if( quantity <> 0
|
and not GlobalParameters_MP::GetIsValueWithinRange( quantity, gp.AbsoluteUpperLimit(), gp.AbsoluteLowerLimit() ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_InvalidQuantity( quantity,
|
gp.AbsoluteUpperLimit(),
|
gp.AbsoluteLowerLimit() );
|
}
|
// Check if currency is null
|
else if( isnull( currency ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNullCurrency( type );
|
}
|
// Check if price is valid
|
else if( price < 0.0 )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNegativePrice( price );
|
}
|
// Check if priority is null
|
else if( isnull( priority ) )
|
{
|
feedback_o := Translations::MP_SalesDemand_ValidateInput_IsNullPriority( type );
|
}
|
|
// Add feedback text if any of the preconditions above are violated
|
if( feedback_o <> '' )
|
{
|
pispname := guard( product.Name(), '' );
|
pispname := MacroPlan::GetSubstituteName( pispname );
|
|
ssname := guard( salessegment.Name(), '' );
|
ssname := MacroPlan::GetSubstituteName( ssname );
|
|
feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_SalesDemand_Instance( pispname, ssname, start, end, type ),
|
feedback_o );
|
}
|
|
return feedback_o = '';
|
*]
|
}
|