| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitializeCapacity () id:Method_LibCal_dlgMultipleEvent_InitializeCapacity | 
| { | 
|   #keys: '[415136.0.647371166]' | 
|   Body: | 
|   [* | 
|     // Extensible method USE_PARTIAL_CAPACITY indicates if partial capacity is allowed. | 
|     // If so, then add it as possible option. | 
|     useParticalCapacity := LibCal_Event::USE_PARTIAL_CAPACITY(); | 
|      | 
|     if( useParticalCapacity ) | 
|     { | 
|       ddslType.Strings( ddslType.Strings() + ";" + LibCal_Event::TYPE_PARTIAL() ); | 
|     } | 
|      | 
|     event     := dhEvent.Data(); | 
|     eventType := event.Type(); | 
|      | 
|     // See if the eventType can be used as is or if it should be converted first. | 
|     if( useParticalCapacity ) | 
|     { | 
|       ddslType.Text( eventType ); | 
|     } | 
|     else | 
|     { | 
|       // Partial capacity should not be used. Convert it to Unavailable or Available. | 
|       // This is an edge case that can only happen via import, or when using partial capacity was first enabled and later disabled. | 
|       if( eventType = LibCal_Event::TYPE_PARTIAL() ) | 
|       { | 
|         if( event.PartialCapacity() = 0.0 ) | 
|         { | 
|           eventType := LibCal_Event::TYPE_UNAVAILABLE(); | 
|         } | 
|         else | 
|         { | 
|           eventType := LibCal_Event::TYPE_AVAILABLE(); | 
|         } | 
|      | 
|         // Show a message to inform the user that the EventType and Capacity was changed. | 
|         capacity := LibCal_GlobalState.RealToString( event.PartialCapacity() ); | 
|         WebMessageBox::Warning( "The event type was 'Partial' with Capacity = " + capacity + ", but partial capacity is not enabled." | 
|                               + "The event type is set to '" + eventType + "'.", false, false ); | 
|       } | 
|      | 
|       ddslType.Text( eventType ); | 
|     } | 
|   *] | 
| } |