Set text_body cleanly and don't reference existing reference

This commit is contained in:
David Bomba 2023-05-24 21:35:13 +10:00
parent f09d90aa27
commit a286d8ae7b
4 changed files with 6 additions and 2 deletions

View File

@ -169,7 +169,7 @@ class InvoiceItemSum
private function shouldCalculateTax(): self
{
//
if (!$this->invoice->company->calculate_taxes || !$this->invoice->company->account->isFreeHostedClient()) {
$this->calc_tax = false;
return $this;

View File

@ -180,6 +180,8 @@ class EmailDefaults
$this->email->email_object->body = EmailTemplateDefaults::getDefaultTemplate($this->email->email_object->email_template_body, $this->locale);
}
$this->email->email_object->text_body = strip_tags($this->email->email_object->body);
if ($this->template == 'email.template.custom') {
$this->email->email_object->body = (str_replace('$body', $this->email->email_object->body, str_replace(["\r","\n"], "", $this->email->email_object->settings->email_style_custom)));
}

View File

@ -68,7 +68,7 @@ class EmailMailable extends Mailable
view: $this->email_object->html_template,
text: $this->email_object->text_template,
with: [
'text_body' => strip_tags($this->email_object->body), //@todo this is a bit hacky here.
'text_body' => $this->email_object->text_body, //@todo this is a bit hacky here.
'body' => $this->email_object->body,
'settings' => $this->email_object->settings,
'whitelabel' => $this->email_object->whitelabel,

View File

@ -50,6 +50,8 @@ class EmailObject
public ?string $body = null;
public string $text_body = '';
/** @var array{key: value} $args */
public array $attachments = [];