yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Quintiq file version 2.0
#parent: #root
MethodOverride Synchronize (
  LibCal_StagingParticipation stagingParticipation_i
)
{
  TextBody:
  [*
    stagEvent := stagingParticipation_i.StagingEvent();
    
    // Don't update in case of IsAllDay.
    // In that case the StartDate and EndDate will be updated by SetIsAllDay.
    // Unless the participation has just been created; in that case it must be updated to initialize it.
    // Or unless the StartDate has changed.
    if( not stagEvent.IsAllDay()
        or this.StartDate().IsInfinite()
        or this.StartDate() <> stagingParticipation_i.StartDate() )
    {
      // Calculate startTime and endTime, taking timezone and DSL into account.
      timezone  := this.Calendar().GetTimeZone();
      startTime := LibCal_Util::CalculateStartTime( timezone, stagingParticipation_i.StartDate(), stagEvent.StartTimeOfDay() );
      endTime   := LibCal_Util::CalculateEndTime(   timezone, stagingParticipation_i.StartDate(), stagEvent.StartTimeOfDay(), stagEvent.Duration() );
      this.Update( startTime.Date( timezone ), endTime.Date( timezone ) );
    }
    
    // Also synchronize the RecurrencePeriod.
    super.Synchronize( stagingParticipation_i );
  *]
}