yanweiyuan3
2023-08-09 588bc7829387dfc761cc25f06f77d4c81818bd10
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
Method ResetInvalidTransitionPeriodTasks (
  CampaignType_MP fromcampaigntype,
  CampaignType_MP tocampaigntype,
  Duration maxduration
)
{
  Description: 'Reset period task quantities on transitions that will be deleted.'
  TextBody:
  [*
    // All transitions will be deleted in case of change of from/to campaign type
    if( fromcampaigntype <> this.FromCampaignType()
        or tocampaigntype <> this.ToCampaignType() )
    {
      traverse( this, Transition_MP, transition )
      {
        transition.ResetPeriodTasks();
      }
    }
    
    // All transition which no longer respect the max duration constraint will be deleted
    else if( maxduration < this.DefaultMaxDuration() )
    {
      traverse( this, Transition_MP, transition, transition.Duration() > maxduration )
      {
        transition.ResetPeriodTasks();
      }
    }
  *]
}