src/Shop/InvoiceManager.php
public function sourceStatusChange(Source $invoiceSource)
    {
        $result = $this->getInvoiceResult('InvoiceManager::sourceStatusChange()');
        $status = $invoiceSource->getStatus();
        $shopEventSettings = $this->getConfig()->getShopEventSettings();
        if ($invoiceSource->getType() === Source::Order) {
            $doSend = in_array($status, $shopEventSettings['triggerOrderStatus']);
            $arguments = array($status, implode(',', $shopEventSettings['triggerOrderStatus']));
            $notSendReason = Result::NotSent_WrongStatus;
        } else {
            $doSend = $shopEventSettings['triggerCreditNoteEvent'] === PluginConfig::TriggerCreditNoteEvent_Create;
            $arguments = array();
            $notSendReason = Result::NotSent_TriggerCreditNoteEventNotEnabled;
        }
        if ($doSend) {
            $result = $this->createAndSend($invoiceSource, $result);
            // Add argument to send status, this will add the current status and
            // the set of statuses on which to send to the log line.
            $result->setSendStatus($result->getSendStatus(), $arguments);
        } else {
            $result->setSendStatus($notSendReason, $arguments);
        }
        $this->getLog()->notice($this->getSendResultLogText($invoiceSource, $result));
        return $result;
    }
public function sourceStatusChange(Source $invoiceSource)
    {
        $result = $this->getInvoiceResult('InvoiceManager::sourceStatusChange()');
        $status = $invoiceSource->getStatus();
        $shopEventSettings = $this->getConfig()->getShopEventSettings();
        if ($invoiceSource->getType() === Source::Order) {
            $doSend = in_array($status, $shopEventSettings['triggerOrderStatus']);
            $arguments = array($status, implode(',', $shopEventSettings['triggerOrderStatus']));
            $notSendReason = Result::NotSent_WrongStatus;
        } else {
            $doSend = $shopEventSettings['triggerCreditNoteEvent'] === PluginConfig::TriggerCreditNoteEvent_Create;
            $arguments = array();
            $notSendReason = Result::NotSent_TriggerCreditNoteEventNotEnabled;
        }
        if ($doSend) {
            $result = $this->createAndSend($invoiceSource, $result);
            // Add argument to send status, this will add the current status and
            // the set of statuses on which to send to the log line.
            $result->setSendStatus($result->getSendStatus(), $arguments);
        } else {
            $result->setSendStatus($notSendReason, $arguments);
        }
        $this->getLog()->notice($this->getSendResultLogText($invoiceSource, $result));
        return $result;
    }
public function sourceStatusChange ( Source $ invoiceSource ) { $ result = $ this -> getInvoiceResult ( 'InvoiceManager::sourceStatusChange()' ) ; $ status = $ invoiceSource -> getStatus ( ) ; $ shopEventSettings = $ this -> getConfig ( ) -> getShopEventSettings ( ) ; if ( $ invoiceSource -> getType ( ) === Source :: Order ) { $ doSend = in_array ( $ status , $ shopEventSettings [ 'triggerOrderStatus' ] ) ; $ arguments = array ( $ status , implode ( ',' , $ shopEventSettings [ 'triggerOrderStatus' ] ) ) ; $ notSendReason = Result :: NotSent_WrongStatus ; } else { $ doSend = $ shopEventSettings [ 'triggerCreditNoteEvent' ] === PluginConfig :: TriggerCreditNoteEvent_Create ; $ arguments = array ( ) ; $ notSendReason = Result :: NotSent_TriggerCreditNoteEventNotEnabled ; } if ( $ doSend ) { $ result = $ this -> createAndSend ( $ invoiceSource , $ result ) ; // Add argument to send status, this will add the current status and // the set of statuses on which to send to the log line. $ result -> setSendStatus ( $ result -> getSendStatus ( ) , $ arguments ) ; } else { $ result -> setSendStatus ( $ notSendReason , $ arguments ) ; } $ this -> getLog ( ) -> notice ( $ this -> getSendResultLogText ( $ invoiceSource , $ result ) ) ; return $ result ; }
Processes an invoice source status change event.

For now we don't look at credit note statuses, they are always sent.

@param \Siel\Acumulus\Invoice\Source $invoiceSource
The source whose status has changed.

@return \Siel\Acumulus\Invoice\Result
The result of sending (or not sending) the invoice.
Processes an invoice source status change event .