chenqinghong
2024-05-07 3ec06a830367465068963156dcc1d8e522571c13
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
Quintiq file version 2.0
#parent: #root
StaticMethod CreateForWeb (
  String name,
  String parent_name,
  ScenarioManager scenario_manager,
  Entitys checkedEntities,
  Product_MPs checkedProducts,
  SalesSegment_MPs checkedSales_segments,
  const structured_Object periodObjects,
  Boolean isFolder
) as Bookmark
{
  Description:
  [*
    (Web) Logic to keep bookmark as short as possible.
    when all leaf items are checked, save the parent only
  *]
  TextBody:
  [*
    // Use existing create method after finding the parents (if any)
    entities := Bookmark::GetEntitiesToSave( checkedEntities );
    
    units := selectset( entities, Elements.astype( Unit ), e, true ); // Cast to units
    stocking_points := selectset( entities, Elements.astype( StockingPoint_MP ), e, true ); // Cast to SPs
    products := Bookmark::GetProductsToSave( checkedProducts );
    sales_segments := Bookmark::GetSalesSegmentToSave( checkedSales_segments );
    
    return Bookmark::Create( name, parent_name, scenario_manager, units, stocking_points, products, sales_segments, periodObjects, isFolder );
  *]
}