Change storeInvoicePdfAndGetPath method to storeDocumentPdfAndGetPath to make it compatible with other apps like Estimates, Credit/Debit Notes, Sales&Purchase Orders etc.
This commit is contained in:
parent
cc77fa780b
commit
c66f0ac8be
@ -69,7 +69,7 @@ class PaymentReceived extends Notification
|
||||
|
||||
// Attach the PDF file
|
||||
if ($this->attach_pdf) {
|
||||
$message->attach($this->storeInvoicePdfAndGetPath($this->invoice), [
|
||||
$message->attach($this->storeDocumentPdfAndGetPath($this->invoice), [
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ class Invoice extends Notification
|
||||
|
||||
// Attach the PDF file
|
||||
if ($this->attach_pdf) {
|
||||
$message->attach($this->storeInvoicePdfAndGetPath($this->invoice), [
|
||||
$message->attach($this->storeDocumentPdfAndGetPath($this->invoice), [
|
||||
'mime' => 'application/pdf',
|
||||
]);
|
||||
}
|
||||
|
@ -124,17 +124,17 @@ trait Documents
|
||||
return $key;
|
||||
}
|
||||
|
||||
public function storeInvoicePdfAndGetPath($invoice)
|
||||
public function storeDocumentPdfAndGetPath($document)
|
||||
{
|
||||
event(new \App\Events\Document\DocumentPrinting($invoice));
|
||||
event(new \App\Events\Document\DocumentPrinting($document));
|
||||
|
||||
$view = view($invoice->template_path, ['invoice' => $invoice])->render();
|
||||
$view = view($document->template_path, ['invoice' => $document, 'document' => $document])->render();
|
||||
$html = mb_convert_encoding($view, 'HTML-ENTITIES', 'UTF-8');
|
||||
|
||||
$pdf = app('dompdf.wrapper');
|
||||
$pdf->loadHTML($html);
|
||||
|
||||
$file_name = $this->getDocumentFileName($invoice);
|
||||
$file_name = $this->getDocumentFileName($document);
|
||||
|
||||
$pdf_path = storage_path('app/temp/' . $file_name);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user