| Quintiq file version 2.0 | 
| #parent: #root | 
| Method EditTransportCapacityFromListUnitPeriodTransportQuantity ( | 
|   internal[GUIComponent] parent, | 
|   structured[UnitPeriodTransportQuantity] selection | 
| ) id:Method_DialogCreateEditTransportCapacity_EditTransportCapacityFromListUnitPeriodTransportQuantity | 
| { | 
|   #keys: '[121458.0.773757783]' | 
|   Body: | 
|   [* | 
|     // Edit the capacity of the selection unit period times from periods list  | 
|      | 
|     isbatchedit := selection.Size() > 1; | 
|     Dialog.ShowHideComponentForBatchEdit ( isbatchedit, false, true ); | 
|      | 
|     // Need this for excluding itself in pre-condition primary keys checking. | 
|     data := shadow( selection.Element( 0 ).TransportCapacity() ); | 
|      | 
|     // In case selection.Element( 0 ) doesn't bind to any unit availability, calling SetDefaultValue method will return null error. | 
|     if( isnull( data ) ) | 
|     { | 
|       data := selection.Element( 0 ).Unit().TransportCapacity( relshadow, UnitID := selection.Element( 0 ).Unit().ID(), Start := MacroPlan.StartOfPlanning() ); | 
|     } | 
|      | 
|     Dialog.Data( data ); | 
|      | 
|     // Need this so that when the upt doesn't not have a unit availability, the fields in this Dialog will not be blank. | 
|     Dialog.SetDefaultValue( selection.Element( 0 ) ); | 
|      | 
|     result := this.DoModal( parent ); | 
|      | 
|     if( result > 0 ) | 
|     { | 
|       TransportCapacity::CreateOrUpdateForUnitPeriodTransports( selection, | 
|                                                                 data.TimeUnit(), | 
|                                                                 not isbatchedit or CheckBoxBatchEditLotSize.Checked(), | 
|                                                                 data.LotSize(), | 
|                                                                 not isbatchedit or CheckBoxBatchEditCapacity.Checked(), | 
|                                                                 data.MinimumCapacity(), | 
|                                                                 data.MaximumCapacity(), | 
|                                                                 not isbatchedit or CheckBoxBatchEditSecondaryCapacity.Checked(), | 
|                                                                 data.HasSecondaryCapacity(), | 
|                                                                 data.SecondaryLotSize(), | 
|                                                                 data.SecondaryMaximumCapacity(), | 
|                                                                 data.SecondaryMinimumCapacity(), | 
|                                                                 data.SecondaryUnitOfMeasureName(), | 
|                                                                 CheckBoxThisPeriodOnwards.Checked() | 
|                                                               ); | 
|     } | 
|   *] | 
| } |