| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitializeRecurrencePeriod ( | 
|   LibCal_RecurrencePeriod recurrencePeriod_i | 
| ) id:Method_LibCal_dlgSubscription_InitializeRecurrencePeriod | 
| { | 
|   #keys: '[131094.0.2063146379]' | 
|   Body: | 
|   [* | 
|     // Take over the existing period. | 
|     if( not isnull( recurrencePeriod_i ) ) | 
|     { | 
|       startDate := recurrencePeriod_i.StartDate(); | 
|        | 
|       dsStartOfPeriod.Date( startDate ); | 
|       dhStartOfPeriod.Data( startDate ); | 
|      | 
|       periodType := recurrencePeriod_i.PeriodType(); | 
|        | 
|       // NoEnd | 
|       if( periodType = LibCal_RecurrencePeriod::TYPE_WITHOUTEND() ) | 
|       { | 
|         dsEndOfPeriod.Enabled( false, "" ); | 
|         dsEndOfPeriod.Date( startDate );  // Default the EndDate to the StartDate | 
|       } | 
|      | 
|       // NOTE: setting #occurrences is not supported for Subscriptions in the UI. | 
|       //       If type 'NrOfOccurrences' is encountered, which can only be the case in importing data, | 
|       //       the type is initialized here as 'WithEndDate', i.e. only the EndDate is used. | 
|       else if( periodType = LibCal_RecurrencePeriod::TYPE_NROFOCCURRENCES() ) | 
|       { | 
|         period := recurrencePeriod_i.astype( LibCal_RecurrencePeriodNrOfOccurrences ); | 
|      | 
|         ckbEndOfPeriod.Checked( true ); | 
|         dsEndOfPeriod.Date( period.EndDate() ); | 
|       } | 
|        | 
|       // WithEndDate | 
|       else if( periodType = LibCal_RecurrencePeriod::TYPE_WITHENDDATE() ) | 
|       { | 
|         period := recurrencePeriod_i.astype( LibCal_RecurrencePeriodWithEndDate ); | 
|      | 
|         ckbEndOfPeriod.Checked( true ); | 
|         dsEndOfPeriod.Date( period.EndDate() ); | 
|       } | 
|     } | 
|      | 
|     // Don't shown the times, they are only for non-recurring events. | 
|     durStartTimeOfDay.Visible( false ); | 
|     durEndTimeOfDay  .Visible( false ); | 
|   *] | 
| } |