fixes for custom email templates

This commit is contained in:
David Bomba 2024-05-21 11:40:12 +10:00
parent c166ef82ff
commit e01f100407
7 changed files with 16 additions and 14 deletions

View File

@ -136,8 +136,8 @@ class NinjaMailerJob implements ShouldQueue
$mailable = $this->nmo->mailable;
/** May need to re-build it here */
if (Ninja::isHosted() && method_exists($mailable, 'build')) {
/** May need to re-build it here @todo explain why we need this? */
if (Ninja::isHosted() && method_exists($mailable, 'build') && $this->nmo->settings->email_style != "custom") {
$mailable->build();
}
@ -675,9 +675,6 @@ class NinjaMailerJob implements ShouldQueue
*/
private function preFlightChecksFail(): bool
{
(new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
/* Always send regardless */
if ($this->override) {
return false;

View File

@ -116,6 +116,7 @@ class EmailPayment implements ShouldQueue
$invoice->invitations->each(function ($invite) use ($email_builder) {
$cloned_mailable = unserialize(serialize($email_builder));
$nmo = new NinjaMailerObject();

View File

@ -134,10 +134,6 @@ class InvoiceEmailEngine extends BaseEmailEngine
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->invoice->numberFormatter().'.pdf']]);
}
// $hash = Str::uuid();
// $url = \Illuminate\Support\Facades\URL::temporarySignedRoute('protected_download', now()->addHour(), ['hash' => $hash]);
// Cache::put($hash, $url, now()->addHour());
//attach third party documents
if ($this->client->getSetting('document_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) {
if ($this->invoice->recurring_invoice()->exists()) {

View File

@ -99,7 +99,6 @@ class PaymentEmailEngine extends BaseEmailEngine
->setViewLink('')
->setViewText('');
if ($this->client->getSetting('pdf_email_attachment') !== false && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
$template_in_use = false;

View File

@ -561,10 +561,19 @@ class HtmlEngine
$data['$spc_qr_code'] = ['value' => $this->company->present()->getSpcQrCode($this->client->currency()->code, $this->entity->number, $this->entity->balance, $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company1', $this->settings->custom_value1, $this->client)), 'label' => ''];
if(Ninja::isHosted())
$logo = $this->company->present()->logo($this->settings);
else
$logo = $this->company->present()->logo_base64($this->settings);
$logo_url = $this->company->present()->logo($this->settings);
$data['$company.logo'] = ['value' => $logo ?: ' ', 'label' => ctrans('texts.logo')];
$data['$company_logo'] = &$data['$company.logo'];
$data['$company.logo_url'] = ['value' => $logo_url ?: ' ', 'label' => ctrans('texts.logo')];
$data['$company1'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company1', $this->settings->custom_value1, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company1')];
$data['$company2'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company2', $this->settings->custom_value2, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company2')];
$data['$company3'] = ['value' => $this->helpers->formatCustomFieldValue($this->company->custom_fields, 'company3', $this->settings->custom_value3, $this->client) ?: ' ', 'label' => $this->helpers->makeCustomField($this->company->custom_fields, 'company3')];