Common/EventListener/AbstractSaleListener.php
protected function handleUpdate(SaleInterface $sale)
    {
        $changed = false;

        // Generate number and key
        $changed |= $this->updateNumber($sale);
        $changed |= $this->updateKey($sale);

        // Handle customer information
        $changed |= $this->updateInformation($sale, true);

        // Update pricing
        if ($this->persistenceHelper->isChanged($sale, 'vatNumber')) {
            $changed |= $this->pricingUpdater->updateVatNumberSubject($sale);
        }

        // If customer has changed
        if ($this->persistenceHelper->isChanged($sale, 'customer')) {
            $changed |= $this->saleUpdater->updatePaymentTerm($sale);

            // TODO Update customer's balances

            // TODO For each payments
            // If payment is paid or has changed from paid state

            // TODO For each (credit)invoices
        }

        // Update shipment and amount
        if ($this->persistenceHelper->isChanged($sale, ['shipmentMethod', 'customerGroup'])) {
            $changed = $this->saleUpdater->updateShipmentMethodAndAmount($sale);
        }

        // Update discounts
        if ($this->isDiscountUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateDiscounts($sale, true);
        }

        // Update taxation
        if ($this->isTaxationUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateTaxation($sale, true);
        } elseif ($this->isShipmentTaxationUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateShipmentTaxation($sale, true);
        }

        return $changed;
    }
protected function handleUpdate(SaleInterface $sale)
    {
        $changed = false;

        // Generate number and key
        $changed |= $this->updateNumber($sale);
        $changed |= $this->updateKey($sale);

        // Handle customer information
        $changed |= $this->updateInformation($sale, true);

        // Update pricing
        if ($this->persistenceHelper->isChanged($sale, 'vatNumber')) {
            $changed |= $this->pricingUpdater->updateVatNumberSubject($sale);
        }

        // If customer has changed
        if ($this->persistenceHelper->isChanged($sale, 'customer')) {
            $changed |= $this->saleUpdater->updatePaymentTerm($sale);

            // TODO Update customer's balances

            // TODO For each payments
            // If payment is paid or has changed from paid state

            // TODO For each (credit)invoices
        }

        // Update shipment and amount
        if ($this->persistenceHelper->isChanged($sale, ['shipmentMethod', 'customerGroup'])) {
            $changed = $this->saleUpdater->updateShipmentMethodAndAmount($sale);
        }

        // Update discounts
        if ($this->isDiscountUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateDiscounts($sale, true);
        }

        // Update taxation
        if ($this->isTaxationUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateTaxation($sale, true);
        } elseif ($this->isShipmentTaxationUpdateNeeded($sale)) {
            $changed |= $this->saleUpdater->updateShipmentTaxation($sale, true);
        }

        return $changed;
    }
protected function handleUpdate ( SaleInterface $ sale ) { $ changed = false ; // Generate number and key $ changed |= $ this -> updateNumber ( $ sale ) ; $ changed |= $ this -> updateKey ( $ sale ) ; // Handle customer information $ changed |= $ this -> updateInformation ( $ sale , true ) ; // Update pricing if ( $ this -> persistenceHelper -> isChanged ( $ sale , 'vatNumber' ) ) { $ changed |= $ this -> pricingUpdater -> updateVatNumberSubject ( $ sale ) ; } // If customer has changed if ( $ this -> persistenceHelper -> isChanged ( $ sale , 'customer' ) ) { $ changed |= $ this -> saleUpdater -> updatePaymentTerm ( $ sale ) ; // TODO Update customer's balances // TODO For each payments // If payment is paid or has changed from paid state // TODO For each (credit)invoices } // Update shipment and amount if ( $ this -> persistenceHelper -> isChanged ( $ sale , [ 'shipmentMethod' , 'customerGroup' ] ) ) { $ changed = $ this -> saleUpdater -> updateShipmentMethodAndAmount ( $ sale ) ; } // Update discounts if ( $ this -> isDiscountUpdateNeeded ( $ sale ) ) { $ changed |= $ this -> saleUpdater -> updateDiscounts ( $ sale , true ) ; } // Update taxation if ( $ this -> isTaxationUpdateNeeded ( $ sale ) ) { $ changed |= $ this -> saleUpdater -> updateTaxation ( $ sale , true ) ; } elseif ( $ this -> isShipmentTaxationUpdateNeeded ( $ sale ) ) { $ changed |= $ this -> saleUpdater -> updateShipmentTaxation ( $ sale , true ) ; } return $ changed ; }
Handles the sale update.

@param SaleInterface $sale

@return bool Whether the sale has been changed.
Handles the sale update .