Refactor PDF Service

This commit is contained in:
David Bomba 2023-02-23 21:58:52 +11:00
parent 390c494348
commit 20097b4fa8
2 changed files with 23 additions and 9 deletions

View File

@ -528,7 +528,7 @@ class NinjaMailerJob implements ShouldQueue
*/ */
private function preFlightChecksFail(): bool private function preFlightChecksFail(): bool
{ {
(new \Modules\Admin\Jobs\Account\EmailQuality($this->nmo, $this->company))->run();
/* If we are migrating data we don't want to fire any emails */ /* If we are migrating data we don't want to fire any emails */
if($this->company->is_disabled && !$this->override) if($this->company->is_disabled && !$this->override)
return true; return true;

View File

@ -63,17 +63,10 @@ class PdfService
$this->config = (new PdfConfiguration($this))->init(); $this->config = (new PdfConfiguration($this))->init();
$this->html_variables = $this->config->client ?
(new HtmlEngine($invitation))->generateLabelsAndValues() :
(new VendorHtmlEngine($invitation))->generateLabelsAndValues();
$this->designer = (new PdfDesigner($this))->build();
$this->document_type = $document_type; $this->document_type = $document_type;
$this->options = $options; $this->options = $options;
$this->builder = (new PdfBuilder($this))->build();
} }
/** /**
@ -120,7 +113,28 @@ class PdfService
return $html; return $html;
} }
/**
* Initialize all the services to build the PDF
*
* @return self
*/
public function init(): self
{
$this->html_variables = $this->config->client ?
(new HtmlEngine($this->invitation))->generateLabelsAndValues() :
(new VendorHtmlEngine($this->invitation))->generateLabelsAndValues();
$this->designer = (new PdfDesigner($this))->build();
$this->builder = (new PdfBuilder($this))->build();
return $this;
}
/** /**
* resolvePdfEngine * resolvePdfEngine
* *