Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method NewProductInTrip ( 
 | 
  internal[GUIComponent] parent, 
 | 
  Trip owner, 
 | 
  structured[Product_MP] products 
 | 
) id:Method_DialogCreateEditProductInTrip_NewProductInTrip_502 
 | 
{ 
 | 
  #keys: '[133968.0.256859386]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Create product in trips from a bunch of products 
 | 
    product := products.Element( 0 ); 
 | 
     
 | 
    data := owner.ProductInTrip( relshadow, 
 | 
                                 TripID := owner.ID(), 
 | 
                                 ProductID := guard( product.ID(), '' ), 
 | 
                                 Product_MP := product ); 
 | 
     
 | 
    Dialog.Data( data ); 
 | 
     
 | 
    Dialog.EnableDisableComponents( isnull( Dialog.Data().WrappedInstance() ) and products.Size() = 1 ); 
 | 
     
 | 
    result := this.DoModal( parent ); 
 | 
     
 | 
    if( result > 0 ) 
 | 
    { 
 | 
      ProductInTrip::CreateOrUpdateForTrip( owner, 
 | 
                                            products, 
 | 
                                            data.Quantity() ); 
 | 
    } 
 | 
  *] 
 | 
} 
 |