Quintiq file version 2.0
#parent: #root
Method EditAccount (
  structured[Account] selection,
  internal[GUIComponent] parent
) id:Method_ScenarioManager_DialogCreateEditAccount_EditAccount
{
  #keys: '[110704.0.691397745]'
  Body:
  [*
    // Edit accounts
    
    isbatchedit := selection.Size() > 1;
    Dialog.ShowHideComponentForBatchEdit( isbatchedit, false );
    
    data := shadow( selection.Element( 0 ) );
    
    Dialog.Data( data );
    
    result := this.DoModal( parent );
    
    if( result > 0 )
    {
      if( isbatchedit )
      {                
        Account::Update( selection,
                         CheckBoxBatchEditParent.Checked(),
                         data.Parent(),
                         CheckBoxBatchEditAccountType.Checked(),
                         data.UserAccountTypeName(),
                         CheckBoxBatchEditReportType.Checked(),
                         data.ReportType(),
                         CheckBoxBatchEditBudget.Checked(),
                         data.Budget(),
                         CheckBoxBatchEditDefaultCost.Checked(),
                         data.DefaultCost(),
                         data.DefaultCostDriver(),
                         data.DefaultLengthOfTime(),
                         data.DefaultTimeUnit()
                       );
      }
      else
      {
        data.Commit();
      }
    }
  *]
}
