Fixes for oversized mailables

This commit is contained in:
David Bomba 2023-03-02 20:01:12 +11:00
parent 94f4ff26a5
commit 2105d09059
4 changed files with 32 additions and 17 deletions

View File

@ -4,7 +4,7 @@
/**
* A helper file for Laravel, to provide autocomplete information to your IDE
* Generated for Laravel 9.52.0.
* Generated for Laravel 9.52.4.
*
* This file should not be included in your code, only analyzed by your IDE!
*
@ -10860,12 +10860,12 @@
* Clones a request and overrides some of its parameters.
*
* @return static
* @param array $query The GET parameters
* @param array $request The POST parameters
* @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
* @param array $cookies The COOKIE parameters
* @param array $files The FILES parameters
* @param array $server The SERVER parameters
* @param array|null $query The GET parameters
* @param array|null $request The POST parameters
* @param array|null $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
* @param array|null $cookies The COOKIE parameters
* @param array|null $files The FILES parameters
* @param array|null $server The SERVER parameters
* @static
*/
public static function duplicate($query = null, $request = null, $attributes = null, $cookies = null, $files = null, $server = null)

View File

@ -112,14 +112,14 @@ class EmailEntity implements ShouldQueue
$this->entity->service()->markSent()->save();
$nmo = new NinjaMailerObject;
$nmo->mailable = new TemplateEmail($this->email_entity_builder, $this->invitation->contact, $this->invitation);
$nmo->company = $this->company;
$nmo->mailable = new TemplateEmail($this->email_entity_builder, $this->invitation->contact->withoutRelations(), $this->invitation->withoutRelations());
$nmo->company = $this->company->withoutRelations();
$nmo->settings = $this->settings;
$nmo->to_user = $this->invitation->contact;
$nmo->to_user = $this->invitation->contact->withoutRelations();
$nmo->entity_string = $this->entity_string;
$nmo->invitation = $this->invitation;
$nmo->invitation = $this->invitation->withoutRelations();
$nmo->reminder_template = $this->reminder_template;
$nmo->entity = $this->entity;
$nmo->entity = $this->entity->withoutRelations();
NinjaMailerJob::dispatch($nmo);

View File

@ -39,4 +39,6 @@ class NinjaMailerObject
/* @var bool | App\Models\Invoice | app\Models\Quote | app\Models\Credit | app\Models\RecurringInvoice | app\Models\PurchaseOrder $invitation*/
public $entity = false;
public $reminder_template = '';
}

View File

@ -114,15 +114,19 @@ class InvoiceEmailEngine extends BaseEmailEngine
);
}
$contact = $this->contact->withoutRelations();
$variables = (new HtmlEngine($this->invitation))->makeValues();
$invitation = $this->invitation->withoutRelations();
$this->setTemplate($this->client->getSetting('email_style'))
->setContact($this->contact)
->setVariables((new HtmlEngine($this->invitation))->makeValues())//move make values into the htmlengine
->setContact($contact)
->setVariables($variables)//move make values into the htmlengine
->setSubject($subject_template)
->setBody($body_template)
->setFooter("<a href='{$this->invitation->getLink()}'>".ctrans('texts.view_invoice').'</a>')
->setViewLink($this->invitation->getLink())
->setFooter("<a href='{$invitation->getLink()}'>".ctrans('texts.view_invoice').'</a>')
->setViewLink($invitation->getLink())
->setViewText(ctrans('texts.view_invoice'))
->setInvitation($this->invitation)
->setInvitation($invitation)
->setTextBody($text_body);
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
@ -206,6 +210,15 @@ class InvoiceEmailEngine extends BaseEmailEngine
}
}
$this->invitation = null;
$contact = null;
$variables = null;
$this->invoice = null;
$this->client = null;
$pdf = null;
$expenses = null;
$tasks = null;
return $this;
}
}