Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method EditInventorySpecificationFromListPISPIP ( 
 | 
  internal[GUIComponent] parent, 
 | 
  structured[ProductInStockingPointInPeriod] selection 
 | 
) id:Method_DialogCreateEditInventorySpecification_EditInventorySpecificationFromListPISPIP 
 | 
{ 
 | 
  #keys: '[105706.1.245085157]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Edit the inventory specification of the selection pispip from periods list 
 | 
    pispip := selection.Element( 0 ); 
 | 
    isbatchedit := selection.Size() > 1; 
 | 
    Dialog.ShowHideComponentForBatchEdit( isbatchedit, false ); 
 | 
     
 | 
    // Need this for excluding itself in pre-condition primary keys checking. 
 | 
    data := shadow( pispip.InventorySpecification() ); 
 | 
     
 | 
    // In case selection.Element( 0 ) doesn't bind to any inventory specification, calling SetDefaultValue method will return null error. 
 | 
    // Check start in case of editing from PISPIP later than the existing IS, the Start date will be off if we pass in existing IS 
 | 
    if( isnull( data ) 
 | 
        or data.Start() <> pispip.Start().Date() ) 
 | 
    { 
 | 
      pisp := pispip.ProductInStockingPoint_MP(); 
 | 
      data := pisp.Product_MP().InventorySpecification( relshadow, ProductID := pisp.ProductID(), StockingPointID := pisp.StockingPointID(), Start := pispip.Start().Date() ); 
 | 
      data.StockingPoint_MP( relset, pisp.StockingPoint_MP() ); 
 | 
    } 
 | 
     
 | 
    Dialog.Data( data ); 
 | 
     
 | 
    // Need this so that when the pispip doesn't not have a inventory specification, the fields in this Dialog will not be blank. 
 | 
    Dialog.SetDefaultValue( selection.Element( 0 ) ); 
 | 
     
 | 
    result := this.DoModal( parent ); 
 | 
     
 | 
    if ( result > 0 ) 
 | 
    { 
 | 
      InventorySpecification::CreateOrUpdateForProductInStockingPointInPeriods( selection, 
 | 
                                                                                false, 
 | 
                                                                                false, 
 | 
                                                                                0.0, 
 | 
                                                                                0.0, 
 | 
                                                                                not isbatchedit or CheckBoxBatchEditMinLevel.Checked(), 
 | 
                                                                                data.HasMinLevelInDays(), 
 | 
                                                                                data.MinLevelInDays(), 
 | 
                                                                                data.MinLevelInQuantity(), 
 | 
                                                                                not isbatchedit or CheckBoxBatchEditMaxLevel.Checked(), 
 | 
                                                                                data.HasMaxLevel(), 
 | 
                                                                                data.HasMaxLevelInDays(), 
 | 
                                                                                data.MaxLevelInDays(), 
 | 
                                                                                data.MaxLevelInQuantity(), 
 | 
                                                                                false ); 
 | 
     
 | 
    } 
 | 
  *] 
 | 
} 
 |