Quintiq file version 2.0
#parent: #root
Method ValuesPeriodRangeOK () as Boolean id:Method_LibCal_dlgEvent_ValuesPeriodRangeOK
{
  #keys: '[131094.0.2140050911]'
  Body:
  [*
    // Some additional checks that should result in the OK-button being disabled, but should not prevent the EndOfPeriod from being set.
    feedback   := FeedbackObject::LocalFeedback();
    periodKind := "recurrence";
    
    // EndOfPeriod must be greater than StartOfPeriod.
    startOfPeriod := datStartOfPeriod.Date();
    endOfPeriod   := datEndOfPeriod  .Date();
    
    if( ckbEndBy.Checked() and
        endOfPeriod < startOfPeriod )
    {
      feedback.AddHard( Translations::Period_EndMustBeGreaterThanStartOfPeriod( periodKind,
                                                                                startOfPeriod.Format( Translations::DateFormat() ),
                                                                                endOfPeriod  .Format( Translations::DateFormat() ) ) );
    }
    
    // EndOfPeriod must be greater than StartOfCalendar.
    startOfCalendar := dhLeadingParticipation.Data().Calendar().StartDate();
    if( ckbEndBy.Checked() and
        endOfPeriod < startOfCalendar )
    {
      feedback.AddHard( Translations::Period_EndMustBeGreaterThanStartOfCalendar( periodKind,
                                                                                  endOfPeriod    .Format( Translations::DateFormat() ),
                                                                                  startOfCalendar.Format( Translations::DateFormat() ) ) ); 
    }
    
    return feedback.IsAllowed();
  *]
}
