| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   StockingPoint_MP stockingpoint, | 
|   Date start, | 
|   Real maxcapacity, | 
|   StockingPointCapacity stockingpointcapacity, | 
|   Boolean checkunique | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check for input obtained from UI' | 
|   TextBody: | 
|   [* | 
|     // Validate input from UI | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|     gp := guard( stockingpoint.MacroPlan().GlobalParameters_MP(), null( GlobalParameters_MP ) ); | 
|      | 
|     // Check if the primary keys is unique | 
|     if( checkunique | 
|         and not StockingPointCapacity::IsPrimaryKeysUnique( stockingpoint, start, stockingpointcapacity ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPointCapacity_ValidateInput_IsNotUnique(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if max capacity is less than zero | 
|     else if( maxcapacity < 0.0 ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPointCapacity_ValidateInput_IsNegativeMaxCapacity( maxcapacity ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if max capacity is within the allowed range | 
|     else if( maxcapacity <> 0 | 
|              and not GlobalParameters_MP::GetIsValueWithinRange( maxcapacity, | 
|                                                                  gp.AbsoluteUpperLimit(), | 
|                                                                  gp.AbsoluteLowerLimit() ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPointCapacity_ValidateInput_InvalidMaxCapacity( maxcapacity, | 
|                                                                                              gp.AbsoluteUpperLimit(), | 
|                                                                                              gp.AbsoluteLowerLimit() ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if stocking point is null | 
|     else if( isnull( stockingpoint ) ) | 
|     { | 
|       feedback_o := Translations::MP_StockingPointCapacity_ValidateInput_IsNullStockingPoint(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|      | 
|     // Add instance text if any of the preconditions above are violated | 
|     if( feedback_o <> '' ) | 
|     { | 
|       spname := MacroPlan::GetSubstituteName( guard( stockingpoint.Name(), '' ) ); | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_StockingPointCapacity_Instance( spname, start ), | 
|                                                              feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |