mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Refactor for attachments
This commit is contained in:
parent
d0bb55f0c2
commit
448d3a2246
@ -143,11 +143,11 @@ class InvoiceEmailEngine extends BaseEmailEngine
|
|||||||
|
|
||||||
// Storage::url
|
// Storage::url
|
||||||
foreach ($this->invoice->documents as $document) {
|
foreach ($this->invoice->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->invoice->company->documents as $document) {
|
foreach ($this->invoice->company->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$line_items = $this->invoice->line_items;
|
$line_items = $this->invoice->line_items;
|
||||||
@ -165,7 +165,7 @@ class InvoiceEmailEngine extends BaseEmailEngine
|
|||||||
->cursor()
|
->cursor()
|
||||||
->each(function ($expense) {
|
->each(function ($expense) {
|
||||||
foreach ($expense->documents as $document) {
|
foreach ($expense->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -181,7 +181,7 @@ class InvoiceEmailEngine extends BaseEmailEngine
|
|||||||
->cursor()
|
->cursor()
|
||||||
->each(function ($task) {
|
->each(function ($task) {
|
||||||
foreach ($task->documents as $document) {
|
foreach ($task->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ class PurchaseOrderEmailEngine extends BaseEmailEngine
|
|||||||
|
|
||||||
// Storage::url
|
// Storage::url
|
||||||
foreach ($this->purchase_order->documents as $document) {
|
foreach ($this->purchase_order->documents as $document) {
|
||||||
// $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]);
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
// $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->purchase_order->company->documents as $document) {
|
foreach ($this->purchase_order->company->documents as $document) {
|
||||||
// $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]);
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
// $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class QuoteEmailEngine extends BaseEmailEngine
|
|||||||
// $this->setAttachments([$this->quote->pdf_file_path($this->invitation)]);
|
// $this->setAttachments([$this->quote->pdf_file_path($this->invitation)]);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
$pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle());
|
$pdf = ((new CreateRawPdf($this->invitation, $this->invitation->company->db))->handle());
|
||||||
|
|
||||||
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->quote->numberFormatter().'.pdf']]);
|
$this->setAttachments([['file' => base64_encode($pdf), 'name' => $this->quote->numberFormatter().'.pdf']]);
|
||||||
}
|
}
|
||||||
@ -133,11 +133,11 @@ class QuoteEmailEngine extends BaseEmailEngine
|
|||||||
|
|
||||||
// Storage::url
|
// Storage::url
|
||||||
foreach ($this->quote->documents as $document) {
|
foreach ($this->quote->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->quote->company->documents as $document) {
|
foreach ($this->quote->company->documents as $document) {
|
||||||
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, 'file' => base64_encode($document->getFile())]]);
|
$this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => NULL, ]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +162,11 @@ class TemplateEmail extends Mailable
|
|||||||
// // $this->attachData($file_data, $file['name']);
|
// // $this->attachData($file_data, $file['name']);
|
||||||
// $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
|
// $this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
|
||||||
// }
|
// }
|
||||||
|
if(array_key_exists('file', $file))
|
||||||
$this->attachData(base64_decode($file['file']), $file['name']);
|
$this->attachData(base64_decode($file['file']), $file['name']);
|
||||||
|
else
|
||||||
|
$this->attach($file['path'], ['as' => $file['name'], 'mime' => null]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
if ($this->invitation && $this->invitation->invoice && $settings->ubl_email_attachment && $this->company->account->hasFeature(Account::FEATURE_PDF_ATTACHMENT)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user