yypsybs
2023-10-10 550ebcf02217f8a0c6fe9001fcfa8e42e9cd6b83
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
51
Quintiq file version 2.0
#parent: #root
Method SetAttributeAfterApplyData () id:Method_DialogCreateEditUnit_SetAttributeAfterApplyData
{
  #keys: '[135040.0.232650761]'
  Body:
  [*
    // Set attributes before commitng the data
    //..following TC style
    
    data := DataHolderDialogData.Data();
    
    // Software bug, data binding on dropdown didn't clear when user select empty parent (it still remembers the last selected parent)
    if( isnull( selParentUnit.Data() ) )
    {
      data.Parent( relset, null( Unit ) );
    }
    
    //handle validity start/end
    start := Date::MinDate();
    end := Date::MaxDate();
    if( CheckboxHasStart.Checked() )
    {
      start := dsStart.Date();
    }
    if( CheckboxHasEnd.Checked() )
    {
      end := dsEnd.Date();
    }
    
    data.StartDate( start );
    data.EndDate( end );
    
    //handle capacitySmoothing
    capacitytype := data.CapacityType()
    istransport := capacitytype = GlobalParameters_MP::GetCapacityTypeTransportTime()
                   or capacitytype = GlobalParameters_MP::GetCapacityTypeTransportQuantity();
    // set to false if user set it to true and change to transport type later              
    if ( istransport )
    {
      data.HasCapacitySmoothing( false );
    }
    
    //handle user frozen duration
    if( CheckboxUserFrozenFutureDuration.Checked() )
    {
      DurationSelectorUserFrozenFutureDuration.Enabled( false, "" );
      data.UserFrozenFutureDuration( DurationSelectorUserFrozenFutureDuration.Duration() );
    }
  *]
}