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
Quintiq file version 2.0
#parent: #root
Method CanBeExtended () declarative remote as Boolean
{
  Description: 'This method checks if a combi can still be extended.'
  TextBody:
  [*
    //Combis can be extended in the following cases:
    // - The last element in the combit ends before the end of the starting subperiod
    // - The end of the last element is later than the period its attached to and there is only 1 combi element which is a campaign
    
    //The combi can no longer be extended if:
    // - The combi is set to isCompleted --> this is needed so we can also create combis that are not consided done accordingf to the rules above
    // - when it is a dead end no existing transition/campaign can follow the last element
    // - when there are more combi elements in the combi than allowed according to the global parameter
    maxextensionelements := this.OptCampaignUnitSubPeriod().OptCampaignUnit().OptCampaign().Macroplan().StrategyMacroPlan().MaxNrOfElemementsCampaignOptimizerCombi();
    value := not this.IsDeadEnd()
             and not this.IsCompleteCombi()
             and counter( this, 
                          OptCampaignCombiElement, 
                          ele, 
                          ele.OptCampaignUnitSubPeriod() = this.LastCombiElement().OptCampaignUnitSubPeriod() ) < maxextensionelements;
    
    return value;
  *]
}