| Quintiq file version 2.0 | 
| #parent: #root | 
| Method UpdateCommitLogic ( | 
|   Boolean isnew | 
| ) | 
| { | 
|   Description: 'Logic used in onCommit of Unit.' | 
|   TextBody: | 
|   [* | 
|     // Commit logic | 
|     isvisible           := true; | 
|     textcolor           := 'Black'; | 
|     namedisplaybehavior := ''; | 
|      | 
|     // Update unit | 
|     this.Update( this.ID(), this.Name(), this.Parent(), | 
|                  this.CapacityType(), | 
|                  this.Group(), this.UnitOfMeasure_MP(), this.Currency_MP(), | 
|                  this.StartDate(), this.EndDate(), this.CampaignTypeDuration(), | 
|                  this.IsPlannedInfinite(), | 
|                  this.MinimumQuantity(), this.HasMaximumQuantity(), this.MaximumQuantity(), this.LotSize(), | 
|                  this.IconName(), | 
|                  this.QuantityToProcess(), | 
|                  this.GISCountryCode(), this.GISCity(), this.GISPostalCode(), | 
|                  this.Notes(), | 
|                  this.HasCapacitySmoothing(), | 
|                  this.IsSmoothCapacityOverAllPeriods(), | 
|                  this.UserCapacitySmoothingLength(), | 
|                  this.CapacitySmoothingPercentageDelta(), | 
|                  this.IsOverlapCapacitySmoothing(), | 
|                  this.IsIncludedInSupplySpecification(), | 
|                  this.IsSupplier(), | 
|                  this.HasUserFrozenFutureDuration(), this.UserFrozenFutureDuration(), | 
|                  this.UseShiftOptimization(), | 
|                  false /*isfromdb*/ ); | 
|                   | 
|     // Create stocking point after update              | 
|     if( isnew ) | 
|     { | 
|       // SynchronizeAfterCreation should have created a default unit node, update it | 
|       view := select( this.MacroPlan(), ViewBase.astype( SupplyChainView ), scv, scv.User() = QuintiqUser::CurrentUser().ShortName() ); | 
|      | 
|      // Reuse the logic from OnCreate | 
|       this.SynchronizeAfterCreation(); | 
|      | 
|       // Create default stocking points | 
|       this.CreateDefaultStockingPoint( view ); | 
|      | 
|       // Unit node is created in SynchronizeAfterCreation, update unit node | 
|       unitnode := select( this, UnitNode, n, n.SupplyChainView() = view ); | 
|       if( not isnull( unitnode ) ) | 
|       { | 
|         unitnode.Update( this.DefaultGridX(), this.DefaultGridY(), isvisible, namedisplaybehavior, textcolor, '' ); | 
|       } | 
|     } | 
|      | 
|     // ---------------------- Quick fix ------------------------ | 
|     // Please remove after the proper fix #16515 | 
|     // The method in designer should be updated, setting relations/attribute will only done in one place. | 
|     // create new unit period | 
|     if( this.SynchronizeUnitPeriod() ) | 
|     { | 
|       this.DeleteOldPeriodCapacity(); | 
|       this.CreateUnitPeriods(); | 
|       this.UnitAvailability( relflush ); | 
|       this.UnitCapacity( relflush ); | 
|       this.TransportAvailability( relflush ); | 
|       this.TransportCapacity( relflush ); | 
|     } | 
|     // ---------------------------------------------------------- | 
|      | 
|     this.SetAllParent(); | 
|   *] | 
| } |