Quintiq file version 2.0
#parent: #root
Method UpdateSubscriptionPeriod (
  String periodType_i,
  Date startDate_i,
  Duration startTime_i,
  Date endDate_i,
  Duration endTime_i
) id:Method_LibCal_dlgSubscription_UpdateSubscriptionPeriod
{
  #keys: '[146730.0.1712641776]'
  Body:
  [*
    // This method is meant to be called when dlgEvent is closed, when it was opened from this dialog.
    
    // A non-recurring Event should subscribe to all (one) occurrences, and has an end date. 
    if( periodType_i = LibCal_RecurrencePattern::TYPE_NONE() )
    {
      ckbAllOccurrences.Checked( true );
      periodType_i := LibCal_RecurrencePeriod::TYPE_WITHENDDATE();
    }
    
    // Update the data of the subscription period with the data from the Event if the subscription
    // is set to all occurrences. Otherwise keep the data of the subscription.
    if( ckbAllOccurrences.Checked() )
    {
      vhStartOfPeriod.  Data(     startDate_i );
      datStartOfPeriod. Date(     startDate_i );
      durStartTimeOfDay.Duration( startTime_i );
      datEndOfPeriod.   Date(     endDate_i   );
      durEndTimeOfDay.  Duration( endTime_i   );
    
      // NrOfOccurrences is not supported for subscriptions, 'cast' it to WithEndDate.
      ckbEndOfPeriod.Checked( periodType_i = LibCal_RecurrencePeriod::TYPE_WITHENDDATE() or
                              periodType_i = LibCal_RecurrencePeriod::TYPE_NROFOCCURRENCES() );
    }
  *]
}
