| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   StockingPoint_MP stockingpoint, | 
|   Product_MP product, | 
|   Date start, | 
|   Real factor, | 
|   DisaggregationFactor old_disaggregationfactor, | 
|   Boolean checkunique | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Validate input, called from designer' | 
|   TextBody: | 
|   [* | 
|     feedback_o := ''; | 
|      | 
|     // Get product name | 
|     productname :=  MacroPlan::GetSubstituteName( guard( product.Name(), '' ) ); | 
|     // Get formatted identification of product instance | 
|     instance := Translations::MP_DisaggregationFactor_Instance( productname, start ); | 
|      | 
|     // Check if stocking point is null | 
|     if( isnull( stockingpoint ) ) | 
|     { | 
|       feedback_o := Translations::MP_DisaggregationFactor_ValidateInput_IsNullStockingPoint(); | 
|     } | 
|     // Check if product is null | 
|     else if( isnull( product ) ) | 
|     { | 
|       feedback_o := Translations::MP_DisaggregationFactor_ValidateInput_IsNullProduct(); | 
|     } | 
|     // Check if the inventory value can be created. | 
|     // For editing of inventory value, exclude itself from the checking of the primary key. | 
|     else if( checkunique | 
|              and not DisaggregationFactor::IsPrimaryKeysUnique( product, stockingpoint, start, old_disaggregationfactor ) ) | 
|     { | 
|       feedback_o := Translations::MP_DisaggregationFactor_ValidateInput_IsNotUnique(); | 
|     } | 
|     // Check if factor is valid | 
|     else if( factor < 0 or factor > 1 ) | 
|     { | 
|       feedback_o := Translations::MP_DisaggregationFactor_ValidateInput_InvalidFactor( factor ); | 
|     } | 
|      | 
|     // Format feedback text if nay of the precondtiions above are violated | 
|     if( feedback_o <> '' ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |