Quintiq file version 2.0
|
#parent: #root
|
StaticMethod ValidateInput (
|
output String feedback_o,
|
output String sanitycheckfeedback_o,
|
Account_MP account,
|
String costdriver,
|
Date start,
|
String timeunit,
|
Number lengthoftime,
|
Real cost,
|
AccountCost accountcost
|
) declarative remote as Boolean
|
{
|
Description: '(TC) Check for input obtained from UI'
|
TextBody:
|
[*
|
// Precondition used to validate input when creating/editing account cost
|
feedback_o := '';
|
sanitycheckfeedback_o := '';
|
|
// If no account is selected
|
if( isnull( account ) )
|
{
|
feedback_o := Translations::MP_AccountCost_ValidateInput_IsNullAccount();
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
// Check if the account cost can be created
|
else if( AccountAssignment::GetTimeUnitVisibility( costdriver ) and lengthoftime <= 0 )
|
{
|
feedback_o := Translations::MP_AccountCost_ValidateInput_InvalidLengthOfTime( lengthoftime );
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
// If cost is less than zero
|
else if( cost < 0 )
|
{
|
feedback_o := Translations::MP_AccountCost_ViolateHasValidCost( cost );
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
// If an account cost is being editted
|
else if( not isnull( accountcost ) )
|
{
|
// Check if the account cost is unique in combination of account name, cost driver, and start date
|
accountcost.GetIsUniqueCost( feedback_o, account.Name(), costdriver, start, null( AccountCosts ) )
|
sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue();
|
}
|
|
return feedback_o = '';
|
*]
|
}
|