admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Method GetAlwaysAvailableEvent () as LibCal_Event
{
  Description: "Get the 'Always available' event, create it if it does not exist."
  TextBody:
  [*
    event := select( this, Event, evnt, true, evnt.IsAlwaysAvailableEvent() );
    
    if( isnull( event ) )
    {
      timezone := this.GetTimeZone();
      
      // This event is *not* default, i.e. it will not be applied automatically to all new calendars.
      // A calendar starts closed and should be opened up explicitly by letting it subscribe to events of type 'Available'.
      // Event 'Always available' can be used to open up a calendar, i.e. make all its capacity available.
      event := LibCal_Event::Create( this, LibCal_Event::ALWAYS_AVAILABLE(),
                                     DateTime::ConstructFromLocalDateTime( timezone, 2000, 01, 01 ),
                                     DateTime::ConstructFromLocalDateTime( timezone, 2050, 01, 01 ) )
                             .SetDescription( Translations::Event_AlwaysAvailableDescription() )
                             .SetTypeAvailable();
      event.IsAlwaysAvailableEvent( true );
      
      event.UpdateCalendar();
    }
    
    return event;
  *]
}