| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CanEditEntityInPeriod ( | 
|   structured_Object entityperiods, | 
|   output String feedback_o | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'Check whether the stockingpointinperiod or unitperiod can be edited' | 
|   TextBody: | 
|   [* | 
|     objectype := selectuniquevalues( entityperiods, Elements, element, true , element.DefinitionName() ); | 
|     aggregated := select( entityperiods, Elements.astype( UnitPeriod ).Unit, unit, true, unit.HasCapacityTypeAggregation() ); | 
|     isinfinite := select ( entityperiods, Elements.astype( UnitPeriod ).Unit, unit , true, unit.HasCapacityTypeInfinite() ); | 
|      | 
|     result := true; | 
|      | 
|     if ( objectype.Size() >1 ) | 
|     { | 
|       result := false; | 
|       feedback_o:= Translations::MP_CapacityPlanning_CapacityDefinition_Incompatible(); | 
|     } | 
|     else if( not isnull( aggregated ) ) | 
|     { | 
|       result := false; | 
|       capacitytype := ifexpr( aggregated.CapacityType() = GlobalParameters_MP::GetCapacityTypeTimeAggregation(),  | 
|                               Translations::MP_CapacityPlanning_TimeAggregated(), Translations::MP_CapacityPlanning_QuantityAggregated() ); | 
|                                  | 
|       feedback_o:= Translations::MP_CapacityPlanning_CapacityDefinition_ChildLevel( capacitytype );  | 
|     } | 
|     else if ( not isnull( isinfinite ) ) | 
|     { | 
|       result := false; | 
|       feedback_o := Translations::MP_UnitPeriodInfinite_NoCapacities();   | 
|     } | 
|     // Block edit if selected object is transition_mp | 
|     else if ( exists( entityperiods, Elements.astype( Transition_MP ), e, true ) ) | 
|     { | 
|      result := false;  | 
|     } | 
|      | 
|     return result; | 
|   *] | 
| } |