Quintiq file version 2.0
#parent: #root
Method OnOK () id:Method_DialogCreateEditStockingPoint_OnOK
{
  #keys: '[135040.0.219519607]'
  Body:
  [*
    // When the user clicks ok,       
    // we either create or edit the data
    this.ApplyChanges();
    this.SetAttributeAfterApplyData();
    
    data := DataHolderDialogData.Data();
    
    if( isnull( data.WrappedInstance() ) )
    { //new
      data.Commit();
      
      // Access the form, select the new SP
      DataHolderForm.Data().ListEntity().SelectByKey( data.WrappedInstance().Key() );
    } 
    else
    { 
      //edit & batch edit
      StockingPoint_MP::Update( DataHolderDialogDatas.Data()
                               ,CheckBoxBatchEditInfinite.Checked()
                               ,CheckBoxBatchEditValidity.Checked()
                               ,false //CheckBoxBatchEditGIS.Checked()
                               ,CheckBoxBatchEditNote.Checked()                
                               ,EditFieldID.Text()
                               ,data.Name()
                               ,data.Unit()
                               ,data.UnitOfMeasure_MP()
                               ,data.Currency_MP()
                               ,data.IconName()              
                               ,data.IsPlannedInfinite() 
                               ,data.Start()
                               ,data.End()
                               ,data.Group()
                               ,data.GISCountryCode()
                               ,data.GISCity()
                               ,data.GISPostalCode()
                               ,data.Notes()
                               ,false );
    }
    
    this.Close();
  *]
}
