src/Helpers/Mailer.php
protected function getSubject(Result $invoiceSendResult)
    {
        $pluginSettings = $this->config->getPluginSettings();
        $isTestMode = $pluginSettings['debug'] === PluginConfig::Send_TestMode;
        $resultInvoice = $invoiceSendResult->getResponse();
        $isConcept = !$invoiceSendResult->hasError() && empty($resultInvoice['entryid']);

        $subjectBase = 'mail_subject';
        if ($isTestMode) {
            $subjectBase .= '_test_mode';
        } elseif ($isConcept) {
            $subjectBase .= '_concept';
        }
        $subject = $this->t($subjectBase);

        $subjectResult = 'mail_subject';
        switch ($invoiceSendResult->getStatus()) {
            case Result::Status_Exception:
                $subjectResult .= '_exception';
                break;
            case Result::Status_Errors:
                $subjectResult .= '_error';
                break;
            case Result::Status_Warnings:
                $subjectResult .= '_warning';
                break;
            case Result::Status_Success:
            default:
                $subjectResult .= '_success';
                break;
        }
        $subject .= ': ' . $this->t($subjectResult);

        if ($isTestMode || $isConcept || $invoiceSendResult->hasError()) {
            $emailAsPdfSettings = $this->config->getEmailAsPdfSettings();
            if ($emailAsPdfSettings['emailAsPdf']) {
                // Normally, Acumulus will send a pdf to the client, but due to
                // 1 of the conditions above this was not done.
                $subject .= ', ' . $this->t('mail_subject_no_pdf');
            }
        }

        return $subject;
    }
protected function getSubject(Result $invoiceSendResult)
    {
        $pluginSettings = $this->config->getPluginSettings();
        $isTestMode = $pluginSettings['debug'] === PluginConfig::Send_TestMode;
        $resultInvoice = $invoiceSendResult->getResponse();
        $isConcept = !$invoiceSendResult->hasError() && empty($resultInvoice['entryid']);

        $subjectBase = 'mail_subject';
        if ($isTestMode) {
            $subjectBase .= '_test_mode';
        } elseif ($isConcept) {
            $subjectBase .= '_concept';
        }
        $subject = $this->t($subjectBase);

        $subjectResult = 'mail_subject';
        switch ($invoiceSendResult->getStatus()) {
            case Result::Status_Exception:
                $subjectResult .= '_exception';
                break;
            case Result::Status_Errors:
                $subjectResult .= '_error';
                break;
            case Result::Status_Warnings:
                $subjectResult .= '_warning';
                break;
            case Result::Status_Success:
            default:
                $subjectResult .= '_success';
                break;
        }
        $subject .= ': ' . $this->t($subjectResult);

        if ($isTestMode || $isConcept || $invoiceSendResult->hasError()) {
            $emailAsPdfSettings = $this->config->getEmailAsPdfSettings();
            if ($emailAsPdfSettings['emailAsPdf']) {
                // Normally, Acumulus will send a pdf to the client, but due to
                // 1 of the conditions above this was not done.
                $subject .= ', ' . $this->t('mail_subject_no_pdf');
            }
        }

        return $subject;
    }
protected function getSubject ( Result $ invoiceSendResult ) { $ pluginSettings = $ this -> config -> getPluginSettings ( ) ; $ isTestMode = $ pluginSettings [ 'debug' ] === PluginConfig :: Send_TestMode ; $ resultInvoice = $ invoiceSendResult -> getResponse ( ) ; $ isConcept = ! $ invoiceSendResult -> hasError ( ) && empty ( $ resultInvoice [ 'entryid' ] ) ; $ subjectBase = 'mail_subject' ; if ( $ isTestMode ) { $ subjectBase .= '_test_mode' ; } elseif ( $ isConcept ) { $ subjectBase .= '_concept' ; } $ subject = $ this -> t ( $ subjectBase ) ; $ subjectResult = 'mail_subject' ; switch ( $ invoiceSendResult -> getStatus ( ) ) { case Result :: Status_Exception : $ subjectResult .= '_exception' ; break ; case Result :: Status_Errors : $ subjectResult .= '_error' ; break ; case Result :: Status_Warnings : $ subjectResult .= '_warning' ; break ; case Result :: Status_Success : default : $ subjectResult .= '_success' ; break ; } $ subject .= ': ' . $ this -> t ( $ subjectResult ) ; if ( $ isTestMode || $ isConcept || $ invoiceSendResult -> hasError ( ) ) { $ emailAsPdfSettings = $ this -> config -> getEmailAsPdfSettings ( ) ; if ( $ emailAsPdfSettings [ 'emailAsPdf' ] ) { // Normally, Acumulus will send a pdf to the client, but due to // 1 of the conditions above this was not done. $ subject .= ', ' . $ this -> t ( 'mail_subject_no_pdf' ) ; } } return $ subject ; }
Returns the subject for the mail.

The subject depends on:
- the result status.
- whether the invoice was sent in test mode.
- whether the invoice was sent as concept.
- the emailAsPdf setting.

@param \Siel\Acumulus\Invoice\Result $invoiceSendResult

@return string
Returns the subject for the mail .