Quintiq file version 2.0
#parent: #root
Method ValuesRecurrenceIntervalOK () as Boolean id:Method_LibCal_dlgEvent_ValuesRecurrenceIntervalOK
{
  #keys: '[131094.0.1648104610]'
  Body:
  [*
    feedback    := FeedbackObject::LocalFeedback();
    patternType := this.GetPatternType();
    unit        := "";
    
    if( patternType = LibCal_RecurrencePattern::TYPE_DAILY() and 
        guard( [Number]edtEveryNrOfDays.Text(), 0 ) = 0 )
    { 
      unit := "days";
    }
    
    else if( patternType = LibCal_RecurrencePattern::TYPE_WEEKLY() and
        guard( [Number]edtEveryNrOfWeeks.Text(), 0 ) = 0 )
    { 
      unit := "weeks";
    }
    
    if( patternType = LibCal_RecurrencePattern::TYPE_MONTHLY() and
        ( ( ckbMonthlyDay.Checked()     and guard( [Number]edtMonthlyDayEveryNrOfMonths.Text(),     0 ) = 0 ) or
          ( ckbMonthlyPattern.Checked() and guard( [Number]edtMonthlyPatternEveryNrOfMonths.Text(), 0 ) = 0 ) ) )
    { 
      unit := "months";
    }
    
    if( patternType = LibCal_RecurrencePattern::TYPE_YEARLY() and
        guard( [Number]edtEveryNrOfYears.Text(), 0 ) = 0 )
    { 
      unit := "years";
    }
    
    if( unit <> "" )
    {
      feedback.AddHard( Translations::Pattern_InvalidRecurrenceInterval( unit ) );
    }
    
    return feedback.IsAllowed();
  *]
}
