admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
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
Quintiq file version 2.0
#parent: #root
Method New (
  internal[GUIComponent] parent
) as FulfillmentRestriction id:Method_DialogCreateEditFulfillmentRestriction_New
{
  #keys: '[123718.0.364071453]'
  Body:
  [*
    // New fulfillment restriction
    
    // Get a default sales segment so we can relshadow fulfillment restriction and bind to dialog
    // Follow the expression filter defined in data extractor for dropdown
    product := null( Product_MP );
    salessegment := FulfillmentRestriction::GetDefaultOwner( MacroPlan, product );
    // Set default start date
    startDate := Date::MinDate();
    
    data := salessegment.FulfillmentRestriction( relshadow, SalesSegmentName := "", ProductID := guard( product.ID(), "" ), StartDate := startDate  );
    data.Product_MP( relset, product );
    
    // Set default end date
    enddate := Date::MaxDate();
    data.EndDate( enddate );
    
    Dialog.Data( data );
    
    if ( Dialog.DoModal( parent ) > 0 )
    {
      data.Commit();
    }
    
    return data.WrappedInstance();
  *]
}