Quintiq file version 2.0
#parent: PanelOrderLockHeader_545/ButtonOrderLockHeaderUnlock
Response OnClick () id:Response_PanelOrderLockHeader_545_ButtonOrderLockHeaderUnlock_OnClick
{
  #keys: '[412960.0.250520489]'
  CanBindMultiple: false
  DefinitionID: 'Responsedef_WebButton_OnClick'
  GroupServerCalls: true
  Precondition:
  [*
    checkorders := DataHolderOrderLockCheckedOrder.Data();
    pispips := construct( ProductInStockingPointInPeriods );
    traverse( checkorders, Elements, order ){
      pispips.Add( selectset( order, ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip, true ) );
      }
    return ProductInStockingPointInPeriod::CanLockUnlock( pispips, feedback );
  *]
  QuillAction
  {
    Body:
    [*
      checkorders := DataHolderOrderLockCheckedOrder.Data();
      pispips := construct( ProductInStockingPointInPeriods );
      macroplan := MacroPlan;
      traverse( checkorders, Elements, order ){
        pispips := pispips.Add( selectset( order, ProductInStockingPoint_MP.ProductInStockingPointInPeriod, pispip, pispip.SupplyQuantity() > 0 ) );
        }
      
      pispipLeafs := selectset( pispips, 
                                Elements.astype( ProductInStockingPointInPeriodPlanningLeaf ), 
                                pispip, 
                                true );
      
      CustomerOrder::LockUnlock( macroplan, checkorders, false );
      ProductInStockingPointInPeriod::LockUnlockPlanning( pispipLeafs, false, true );
    *]
  }
}
