Quintiq file version 2.0
|
#parent: #root
|
StaticMethod ValidateInput (
|
output String feedback_o,
|
output String sanitycheckfeedback_o,
|
MacroPlan owner,
|
Routing routing,
|
String id,
|
String name,
|
Date start,
|
Date end,
|
Boolean checkuniqueid
|
) declarative remote as Boolean
|
{
|
Description: 'Check input is valid'
|
TextBody:
|
[*
|
// Adhi Feb-10-2016 (created)
|
maxnamelength := GlobalParameters_MP::GetLengthOfNames();
|
feedback_o := '';
|
sanitycheckfeedback_o := '';
|
|
// Check ID
|
if( checkuniqueid
|
and exists( owner, Routing, r, r <> routing, r.ID() = id ) )
|
{
|
feedback_o := Translations::MP_Routing_ValidateInput_IsIDExists();
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
|
// Invalid start and end
|
else if( start >= end )
|
{
|
feedback_o := Translations::MP_Routing_ValidateInput_IsInvalidStartEndDate( end, start );
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
|
// Invalid name
|
else if( name = '' or name.Length() > maxnamelength )
|
{
|
feedback_o := Translations::MP_Routing_ValidateInput_IsInvalidName( maxnamelength );
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();
|
}
|
|
// Invalid ID, empty or max length
|
else if( id = '' or id.Length() > maxnamelength )
|
{
|
feedback_o := Translations::MP_Routing_ValidateInput_IsInvalidID( maxnamelength );
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning();
|
}
|
|
// Add instance text
|
if( feedback_o <> '' )
|
{
|
routingname := MacroPlan::GetSubstituteName( name );
|
instance := Translations::MP_Routing_Instance( routingname );
|
feedback_o := SanityCheckMessage::GetFormattedMessage( instance,
|
feedback_o );
|
}
|
|
return feedback_o = '';
|
*]
|
}
|