mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Refactor Phantom JS building HTML
This commit is contained in:
parent
3bef11c87e
commit
1de7a693cc
@ -75,7 +75,6 @@ class EmailBuilder
|
||||
*/
|
||||
public function setSubject($subject)
|
||||
{
|
||||
//$this->subject = $this->parseTemplate($subject, false, $this->contact);
|
||||
|
||||
if (! empty($this->variables)) {
|
||||
$subject = str_replace(array_keys($this->variables), array_values($this->variables), $subject);
|
||||
|
@ -70,7 +70,8 @@ class EmailInvoice extends BaseMailerJob implements ShouldQueue
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{info("invoice email");
|
||||
{
|
||||
|
||||
MultiDB::setDB($this->company->db);
|
||||
|
||||
$this->setMailDriver();
|
||||
|
@ -37,10 +37,13 @@ class Phantom
|
||||
|
||||
if ($invitation instanceof InvoiceInvitation) {
|
||||
$entity = 'invoice';
|
||||
$entity_design_id = 'invoice_design_id';
|
||||
} elseif ($invitation instanceof CreditInvitation) {
|
||||
$entity = 'credit';
|
||||
$entity_design_id = 'credit_design_id';
|
||||
} elseif ($invitation instanceof QuoteInvitation) {
|
||||
$entity = 'quote';
|
||||
$entity_design_id = 'quote_design_id';
|
||||
}
|
||||
|
||||
$entity_obj = $invitation->{$entity};
|
||||
@ -82,19 +85,22 @@ class Phantom
|
||||
|
||||
$invitation = $invitation_instance::whereRaw('BINARY `key`= ?', [$invitation_key])->first();
|
||||
|
||||
|
||||
$entity_obj = $invitation->{$entity};
|
||||
|
||||
$entity_obj->load('client');
|
||||
|
||||
App::setLocale($invitation->contact->preferredLocale());
|
||||
|
||||
$design_id = $entity_obj->design_id ? $entity_obj->design_id : $this->decodePrimaryKey($entity_obj->client->getSetting($entity.'_design_id'));
|
||||
// $design_id = $entity_obj->design_id ? $entity_obj->design_id : $this->decodePrimaryKey($entity_obj->client->getSetting($entity_design_id));
|
||||
// $design = Design::find($design_id);
|
||||
// $designer = new Designer($entity_obj, $design, $entity_obj->client->getSetting('pdf_variables'), $entity);
|
||||
// $data['html'] = (new HtmlEngine($designer, $invitation, $entity))->build();
|
||||
|
||||
$design = Design::find($design_id);
|
||||
|
||||
$designer = new Designer($entity_obj, $design, $entity_obj->client->getSetting('pdf_variables'), $entity);
|
||||
|
||||
$data['html'] = (new HtmlEngine($designer, $invitation, $entity))->build();
|
||||
$entity_design_id = $entity . '_design_id';
|
||||
$entity_design_id = $entity_obj->design_id ? $entity_obj->design_id : $this->decodePrimaryKey($entity_obj->client->getSetting($entity_design_id));
|
||||
$design = Design::find($entity_design_id);
|
||||
$data['html'] = new HtmlEngine(null, $invitation, $entity);
|
||||
|
||||
return view('pdf.html', $data);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user