| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   Currency_MP owner, | 
|   Date start, | 
|   Real rate, | 
|   CurrencyRate_MP currencyrate | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Validate input, called from designer' | 
|   TextBody: | 
|   [* | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|      | 
|     // Currency name | 
|     name := MacroPlan::GetSubstituteName( guard( owner.Name(), '' ) ); | 
|     // Get Currency instance | 
|     instance := Translations::MP_CurrencyRate_Instance( name, start ); | 
|      | 
|     // Check if rate is valid | 
|     if( rate <= 0 ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_CurrencyRate_ValidateInput_IsInvalidRate( rate ) ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if currency rate with the same start time exists | 
|     else if( exists( owner, CurrencyRate_MP, cr, | 
|                      cr <> currencyrate, | 
|                      cr.Start() = start ) ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_CurrencyRate_ValidateInput_IsRateExists() ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if Currency is found | 
|     else if( isnull( owner ) ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_CurrencyRate_ValidateInput_IsNullCurrency() ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|     // Check if Currency is base currency | 
|     else if( owner.IsBase() ) | 
|     { | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( instance, | 
|                                                              Translations::MP_CurrencyRate_ValidateInput_IsBaseCurrency() ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataWarning(); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |