| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod ValidateInput ( | 
|   output String feedback_o, | 
|   output String sanitycheckfeedback_o, | 
|   MacroPlan owner, | 
|   String name, | 
|   Number numberofdays, | 
|   ShiftPattern oldshiftpattern, | 
|   Boolean checkunique | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Validate input for creating/editing ShiftPattern' | 
|   TextBody: | 
|   [* | 
|     // Validate input for creating/editing ShiftPattern | 
|     feedback_o := ''; | 
|     sanitycheckfeedback_o := ''; | 
|      | 
|     // Set the maximum allowed number of days | 
|     maxnumberofdays := 999; | 
|     // Get the maximum allowed length for names | 
|     lengthlimit := GlobalParameters_MP::GetLengthOfNames(); | 
|      | 
|     // Check if name is entered or is within the allowed length | 
|     if( name = '' or name.Length() > lengthlimit  ) | 
|     { | 
|       feedback_o := Translations::MP_ShiftPattern_ValidateInput_IsInvalidName( lengthlimit ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if the entered name is unique | 
|     else if( checkunique | 
|              and exists( owner, ShiftPattern, s, | 
|                          s <> oldshiftpattern, | 
|                          s.Name() = name ) ) | 
|     { | 
|       feedback_o := Translations::MP_ShiftPattern_ValidateInput_IsNameExists(); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|     // Check if the number of days is within the allowed range | 
|     else if( numberofdays <= 0 | 
|              or numberofdays > maxnumberofdays ) | 
|     { | 
|       feedback_o := Translations::MP_ShiftPattern_ValidateInput_IsInvalidNrOfDays( numberofdays, maxnumberofdays ); | 
|       sanitycheckfeedback_o := SanityCheckCategoryLevel::GetSanityCheckCategoryDataIssue(); | 
|     } | 
|      | 
|     // Add instance text | 
|     if( feedback_o <> '' ) | 
|     { | 
|       shiftpatternname := MacroPlan::GetSubstituteName( name ); | 
|       feedback_o := SanityCheckMessage::GetFormattedMessage( Translations::MP_ShiftPattern_Instance( shiftpatternname ), | 
|                                                              feedback_o ); | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |