Quintiq file version 2.0
#parent: #root
Method ConstructScenarioFilter (
  Boolean includedeleted
) as String id:Method_ApplicationLibMacroPlanner_ConstructScenarioFilter
{
  #keys: '[11660.0.11700564]'
  Body:
  [*
    // Filter on scenario
    filter := '';
    if( not includedeleted )
    {
      filter := filter + 'not object.IsDeleted() and'
    }
     
    filter := filter + '( object.CreatedBy()=' + ApplicationLibMacroPlanner.GetUserName().AsQUILL();
    filter := filter + ' or ' + ApplicationScope.Session().CurrentUser().IsAdministrator().AsQUILL() + ' or exists ( object, ScenarioAuthorization, o,  exists ( dataholderusergroup, Elements, el, o.Name() = el.Name() ) ) )';
    filter := filter + ' and not object.IsHidden()';
    
    return filter;
  *]
}
