renhao
2023-09-21 1aa9f2bb83dd9e4b7517f1cbf06b0db53979bb31
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
Quintiq file version 2.0
#parent: #root
Method ConfirmWhenDifferent () as Boolean id:Method_LibCal_dlgCalendarSettings_ConfirmWhenDifferent
{
  #keys: '[146730.0.1422592967]'
  Body:
  [*
    // Explicit confirmation is only required when there are calendars with divergent settings,
    // i.e. with settings that are different from the settings of the calendar of the panel.
    calendarsToUpdate  := dhCalendars.Data();
    divergentCalendars := this.GetDivergentCalendars( dpCalendarSettings.Data(), dhCalendars.Data() );
    continue           := true;
    
    if( divergentCalendars.Size() > 0 )
    {
      dlg := construct( LibCal_dlgCalendarSettingsConfirmation );
      dlg.ShowInfo( dpCalendarSettings.Data(), divergentCalendars );  // Show info about the divergent calendars.
      
      retVal   := dlg.DoModal( this );
      continue := retVal >= 0;
    
      if( retVal = 1 )
      {
        // Only update calendars with the same settings, so remove the divergent calendars.
        calendarsToUpdate := calendarsToUpdate.Difference( divergentCalendars );
      }
    }
    
    if( continue )
    {
      this.UpdateCalendars( calendarsToUpdate );
    }
    
    return continue;
  *]
}