| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   MacroPlan owner, | 
|   StockingPoint_MP stockingpoint, | 
|   String id, | 
|   String name, | 
|   Boolean hasuserstart, | 
|   Date start, | 
|   Boolean hasuserend, | 
|   Date end, | 
|   Currency_MP currency, | 
|   UnitOfMeasure_MP unitofmeasure, | 
|   Boolean checkuniqueid, | 
|   output String sanitycheckfb | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check if the stocking point is valid.' | 
|   TextBody: | 
|   [* | 
|     feedback_o := ''; | 
|      | 
|     lengthlimit := GlobalParameters_MP::GetLengthOfNames(); | 
|      | 
|     // Check ID | 
|     if( checkuniqueid | 
|         and exists( owner, | 
|                     StockingPoint_MP, | 
|                     sp, | 
|                     sp <> stockingpoint, | 
|                     sp.ID() = id ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsIDExists(); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Currency | 
|     else if( isnull( currency ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsNullCurrency(); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // unit of measure | 
|     else if( isnull( unitofmeasure ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsNullUnitOfMeasurement(); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Has Start,End, Start not later than end | 
|     else if( hasuserstart | 
|              and hasuserend | 
|              and start >= end ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsStartDateAfterEndDate( end, start ); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Invalid ID, empty or max length | 
|     else if( id = '' | 
|              or id.Length() > lengthlimit ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsInvalidID( lengthlimit ); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|     // Has name and within limit | 
|     else if( name = '' | 
|              or name.Length() > lengthlimit ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPoint_ValidateInput_IsInvalidName( lengthlimit ); | 
|       sanitycheckfb := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|      | 
|     // Add instance text | 
|     if( feedback_o <> '' ) | 
|     { | 
|       spname := MacroPlan::GetSubstituteName( name ); | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_StockingPoint_Instance( spname ), | 
|                                                              feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |