lazhen
2025-01-09 8afe90b633046db39042aada36b88193062f8cff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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()
                                      );
  *]
}