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
30
31
32
Quintiq file version 2.0
#parent: #root
Function CalcIsModified
{
  TextBody:
  [*
    isModified    := false;
    participation := this.Participation();
    timezone      := this.Calendar().astype( LibCal_Calendar ).GetTimeZone();
    
    if( participation.IsLeading() )
    {
      event := participation.Event();
      isMoved24Hours := this.InitialStart().IsFinite()  // Ignore 'old' intervals that don't have an initial start registered.
                  and   this.Start() <> this.InitialStart()
                  and ( this.Start()  - this.InitialStart() ).HoursAsReal() mod 24 = 0;
                      
      isModified := this.Start().TimeOfDay( timezone ) <> event.StartTimeOfDay()
                 or this.End().  TimeOfDay( timezone ) <> event.EndTimeOfDay()
                 or isMoved24Hours                                      // To detect a move or change in duration of a multitude of 24 hours,
                 or ( this.End() - this.Start() ) <> event.Duration();  // because in that case the TimesOfDay or not changed.
    }
    else
    {
      // For a subscribingETI, take over the value from the LeadingETI.
      isModified := this.LeadingETI().IsModified();
    }
    
    this.IsModified( isModified );
  *]
  InterfaceProperties { Accessibility: 'Module' }
}