Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod CanCreate ( 
 | 
  output String feedback_o, 
 | 
  SalesSegment_MPs salessegments, 
 | 
  Product_MPs products 
 | 
) declarative remote as Boolean 
 | 
{ 
 | 
  Description: 'Returns true if at least one sales segment unit has valid sales level and product selected is a leaf not of system. Used in designer.' 
 | 
  TextBody: 
 | 
  [* 
 | 
     
 | 
    result := feedback_o.Length() =0; 
 | 
     
 | 
    if( salessegments.Size() =0 ) 
 | 
    { 
 | 
      result := false; 
 | 
      feedback_o := Translations::MP_FulfillmentRestriction_CanCreateNew_EmptySalesSegNavSelection(); 
 | 
    } 
 | 
    else if ( products.Size() =0 ) 
 | 
    { 
 | 
      result := false; 
 | 
      feedback_o := Translations::MP_FulfillmentRestriction_CanCreate_EmptyProduct(); 
 | 
    } 
 | 
    else if( not exists( products, Elements, e,  
 | 
                         e.IsLeaf()  
 | 
                         and not e.IsSystem() ) ) 
 | 
    { 
 | 
      result := false; 
 | 
      feedback_o := Translations::MP_FulfillmentRestriction_CanCreateNew_EmptyProductNavSelection(); 
 | 
    } 
 | 
     
 | 
    return result; 
 | 
  *] 
 | 
} 
 |