yanweiyuan3
2023-08-09 fd693f0faf305ec98d7ea03e09fe6787817e71d7
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
Quintiq file version 2.0
#parent: #root
Method SetAttributesBeforeOnApplyData () id:Method_DialogCreateEditProduct_SetAttributesBeforeOnApplyData
{
  #keys: '[124808.1.1739232597]'
  Body:
  [*
    // Set attributes on apply data
    data := Dialog.Data();
    
    // Since we use commit, we need to identiy whether the parent of this product has changed
    // This cannot be done if we commit data.Parent() from SelectionParentProduct(), so we need to disable it
    // and set the attribute ParentID. Propagation will relate this child-parent relation.
    SelectionParentProduct.Enabled( false );
    
    // Parent ID should be empty when the checkbox is not checked / checked but selection is empty
    parentproductid := ifexpr( CheckBoxHasParentProduct.Checked(),
                               guard( SelectionParentProduct.Data().ID(), '' ),
                               '' );
    
    data.ParentID( parentproductid );
    
    // Set the icon name
    data.IconName( LabelImageString.Text() );
    
    // Set IsExcludedFromFulfillmentKPI
    isexcludedfromfulfillmentkpi := ifexpr( CheckBoxIsExcludedFromFulfillmentKPI.Enabled(), 
                                            CheckBoxIsExcludedFromFulfillmentKPI.Checked(), 
                                            data.IsExcludedFromFulfillmentKPI() )
    
    data.IsExcludedFromFulfillmentKPI( isexcludedfromfulfillmentkpi );
    
    // ADSO-47827 Set IsExcludedFromOptimization because 
    // When the checkbox is disabled (with check) it wont register in ApplyChanges.
    // Manually set the boolean value here
    data.IsExcludedFromOptimization( CheckBoxIsExcludedFromOptimization.Checked() );
  *]
}