| Quintiq file version 2.0 | 
| #parent: #root | 
| Method GetHasValidPostponement ( | 
|   output Strings feedback_o, | 
|   output Strings sanitycheckfeedback_o | 
| ) declarative remote as Boolean | 
| { | 
|   TextBody: | 
|   [* | 
|     // Indicate if the poseponement is valid | 
|     value := true; | 
|      | 
|     message := ''; | 
|     psEnd := guard( this.PostponementSpecification().End().Date(), Date::MinDate() ); | 
|      | 
|     // If this SalesDemandInPeriod has PostponedSalesDemand and the EndDate is out of the valid postponement period | 
|     if( this.HasPostponedSalesDemand() | 
|         and this.EndDate() > psEnd ) | 
|     { | 
|       value := false; | 
|       // Get the effective PostponementSpecification | 
|       postponementspec := guard( this.MasterSalesDemand().SalesSegment_MP().EffectivePostponementSpecification(), null( PostponementSpecification ) ); | 
|       // Generate PostponementSpecification's horizon in string, e.g. 3 Months, 1 Day, etc. | 
|       displayEnd := guard( [String] postponementspec.HorizonNrOfTimeUnit() | 
|                            + " " | 
|                            + postponementspec.HorizonTimeUnit() | 
|                            + ifexpr( postponementspec.HorizonNrOfTimeUnit() > 1, 's', '' ), "" ); | 
|              | 
|       message := Translations::MP_BaseSalesDemandInPeriod_GetHasValidDemandManagement_OverPostponementHorizon( displayEnd ); | 
|     } | 
|      | 
|     // If precondition is violated, insert the feedback message into feedback_o and sanitycheckfeedback_o | 
|     if( not isnull( feedback_o ) | 
|         and not value ) | 
|     {  | 
|       instance := Translations::MP_BaseSalesDemandInPeriod_Instance( this.SalesSegmentName(), this.StartDate() ); | 
|       feedback_o.Add( SanityCheckMessage::GetFormattedMessage( instance, message ) ); | 
|       sanitycheckfeedback_o.Add( SanityCheckCategoryLevel::GetSanityCheckCategoryPlanningIssue() ); | 
|     } | 
|      | 
|     return value; | 
|   *] | 
| } |