陈清红
2025-04-14 880f3c0257eeb8c37761d484258fdd102a369a19
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Quintiq file version 2.0
#parent: #root
Method InitializeRecurrencePeriod (
  LibCal_RecurrencePeriod recurrencePeriod_i
) id:Method_LibCal_dlgSubscription_InitializeRecurrencePeriod
{
  #keys: '[131094.1.101592847]'
  Body:
  [*
    // Take over the existing period.
    if( not isnull( recurrencePeriod_i ) )
    {
      startDate := recurrencePeriod_i.StartDate();
      datStartOfPeriod.Date( startDate );
      vhStartOfPeriod .Data( startDate );
    
      periodType := recurrencePeriod_i.PeriodType();
      
      // NoEnd
      if( periodType = LibCal_RecurrencePeriod::TYPE_WITHOUTEND() )
      {
        datEndOfPeriod.Enabled( false );
        datEndOfPeriod.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 );
        datEndOfPeriod.Date( period.EndDate() );
      }
      
      // WithEndDate
      else if( periodType = LibCal_RecurrencePeriod::TYPE_WITHENDDATE() )
      {
        period := recurrencePeriod_i.astype( LibCal_RecurrencePeriodWithEndDate );
    
        ckbEndOfPeriod.Checked( true );
        datEndOfPeriod.Date( period.EndDate() );
      }
    }
    
    // Don't shown the times, they are only for non-recurring events.
    durStartTimeOfDay.Visible( false );
    durEndTimeOfDay  .Visible( false );
  *]
}