Merge pull request #8464 from turbo124/v5-develop

fixes for einvoice
This commit is contained in:
David Bomba 2023-04-23 16:44:08 +10:00 committed by GitHub
commit c4076d8428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -449,22 +449,26 @@ class InvoiceService
if ($force) { if ($force) {
$this->invoice->invitations->each(function ($invitation) { $this->invoice->invitations->each(function ($invitation) {
(new CreateEntityPdf($invitation))->handle(); (new CreateEntityPdf($invitation))->handle();
if ($invitation instanceof InvoiceInvitation)
if ($invitation->company->enable_e_invoice && $invitation instanceof InvoiceInvitation)
{ {
(new CreateEInvoice($invitation->invoice, true))->handle(); (new CreateEInvoice($invitation->invoice, true))->handle();
} }
}); });
return $this; return $this;
} }
$this->invoice->invitations->each(function ($invitation) { if($this->invoice->company->enable_e_invoice) {
CreateEntityPdf::dispatch($invitation); $this->invoice->invitations->each(function ($invitation) {
if ($invitation instanceof InvoiceInvitation) CreateEntityPdf::dispatch($invitation);
{ if ($invitation instanceof InvoiceInvitation) {
CreateEInvoice::dispatch($invitation->invoice, true); CreateEInvoice::dispatch($invitation->invoice, true);
} }
}); });
}
} catch (\Exception $e) { } catch (\Exception $e) {
nlog('failed creating invoices in Touch PDF'); nlog('failed creating invoices in Touch PDF');
} }

View File

@ -196,6 +196,7 @@ class CompanyTransformer extends EntityTransformer
'invoice_task_hours' => (bool) $company->invoice_task_hours, 'invoice_task_hours' => (bool) $company->invoice_task_hours,
'calculate_taxes' => (bool) $company->calculate_taxes, 'calculate_taxes' => (bool) $company->calculate_taxes,
'tax_data' => $company->tax_data ?: new \stdClass, 'tax_data' => $company->tax_data ?: new \stdClass,
'enable_e_invoice' => (bool) $company->enable_e_invoice,
]; ];
} }