Quintiq file version 2.0
#parent: Toolbar/ButtonOK
Response OnClick () id:Response_Toolbar_ButtonOk_OnClick
{
  #keys: '[11660.0.54833189]'
  Body:
  [*
    // Apply changes and close dialog
    Dialog.SetAttributesBeforeOnApplyData();
    Dialog.ApplyChanges();
    Dialog.EndModal(1);
  *]
  DefinitionID: 'Responsedef_GUIButtonBase_OnClick'
  Precondition:
  [*
    product := null( Product_MP );
    
    if( not isnull( Dialog.Data() )
        and Dialog.UserData() <> -1 ) // user data -1 means copying
    {
      product := Dialog.Data().WrappedInstance();
    }
    
    sanitycheckfeedback := '';
    isBatchEdit := CheckBoxBatchEditHasShelfLife.Visible();
    hasShelfLife := CheckBoxHasShelfLife.Checked();
    hasMaturationDays := CheckBoxHasMaturationDays.Checked();
    
    if( isBatchEdit )
    {
      hasShelfLife := hasShelfLife and CheckBoxBatchEditHasShelfLife.Checked();
      hasMaturationDays := hasMaturationDays and CheckBoxBatchEditHasMaturationDays.Checked();
    }
    
    return Product_MP::ValidateInput( feedback,
                                      sanitycheckfeedback ,
                                      MacroPlan,
                                      EditorID.Text(),
                                      EditorProductName.Text(),
                                      SelectionUnitOfMeasurement.Data(),
                                      hasShelfLife,
                                      ApplicationLibMacroPlanner.FormatStringToReal( EditorShelfLife.Text() ),
                                      hasMaturationDays,
                                      ApplicationLibMacroPlanner.FormatStringToReal( EditorMaturationDays.Text() ),
                                      product,
                                      true,
                                      DataHolderEditingProduct.Data()
                                      );
  *]
}
