| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod CanEditCapacities ( | 
|   UnitPeriods unitperiods, | 
|   output String feedback_o | 
| ) declarative remote as Boolean | 
| { | 
|   Description: 'True if batch editing capacity is allowed for all given UnitPeriods' | 
|   TextBody: | 
|   [* | 
|     // Check if the selected set of UnitPeriods can be batch edited | 
|     feedback_o := '' | 
|      | 
|     // Check if there's any Unit of the selected set of UnitPeriods has infinite capacity type | 
|     if( exists( unitperiods, Elements.Unit, u, u.HasCapacityTypeInfinite() ) ) | 
|     { | 
|       feedback_o := Translations::MP_UnitPeriod_CanEditCapacities_IsInfinite(); | 
|     } | 
|     else | 
|     { | 
|       // Check if the selected set of UnitPeriods all belong to the same subclass | 
|       issamesubclass := forall( unitperiods, Elements, up, up.istype( UnitPeriodTime ) ) | 
|                         or forall( unitperiods, Elements, up, up.istype( UnitPeriodQuantity ) ) | 
|                         or forall( unitperiods, Elements, up, up.istype( UnitPeriodTransportQuantity ) ) | 
|                         or forall( unitperiods, Elements, up, up.istype( UnitPeriodTransportTime ) ); | 
|        | 
|       // If the selected set of UnitPeriods do not belong to the same subclass | 
|       if( not issamesubclass ) | 
|       { | 
|         // Check if the selected set of UnitPeriods is either type of UnitPeriodTimeAggregation or UnitPeriodQuantityAggregation | 
|         if( exists( unitperiods, Elements, up, up.istype( UnitPeriodTimeAggregation ) | 
|                                                   or up.istype( UnitPeriodQuantityAggregation ) ) ) | 
|         { | 
|           feedback_o := Translations::MP_UnitPeriod_CanEditCapacities_IsAggregatedCapacitity(); | 
|         } | 
|         else | 
|         { | 
|           feedback_o := Translations::MP_UnitPeriod_CanEditCapacities_IsDifferentSubclass(); | 
|         } | 
|       } | 
|     } | 
|      | 
|     return feedback_o = ''; | 
|   *] | 
| } |