Quintiq file version 2.0
#parent: #root
Method GetSelectedCalendar () as LibCal_Calendar id:Method_LibCal_swEventsAndOccurrences_GetSelectedCalendar
{
  #keys: '[131094.1.380752586]'
  Body:
  [*
    feedback  := FeedbackObject::LocalFeedback();
    calendar  := null( LibCal_Calendar );
    calendars := dhCalendars.Data();
    
    if( isnull( calendars ) )
    {
      feedback.AddHard( Translations::Calendar_DoesNotExist() );
    }
    
    else if( calendars.Size() = 0 )
    {
      feedback.AddHard( Translations::Calendar_NotSelected() );
    }
    
    else if( calendars.Size() > 1 )
    {
      feedback.AddHard( Translations::Calendar_MoreThanOneSelected() );
    }
    
    else
    {
      calendar := calendars.Element( 0 );
    }
    
    return calendar;
  *]
}
