diff --git a/app/Mail/Engine/CreditEmailEngine.php b/app/Mail/Engine/CreditEmailEngine.php index 6e2191b6594c..d6a7bda08b15 100644 --- a/app/Mail/Engine/CreditEmailEngine.php +++ b/app/Mail/Engine/CreditEmailEngine.php @@ -123,21 +123,21 @@ class CreditEmailEngine extends BaseEmailEngine //attach third party documents if ($this->client->getSetting('document_email_attachment') !== false && $this->credit->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) { // Storage::url - foreach ($this->credit->documents as $document) { + $this->credit->documents()->where('is_public',true)->cursor()->each(function($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null, 'file' => base64_encode($document->getFile())]]); } - } + }); - foreach ($this->credit->company->documents as $document) { + $this->credit->company->documents()->where('is_public',true)->cursor()->each(function($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null, 'file' => base64_encode($document->getFile())]]); } - } + }); } return $this; diff --git a/app/Mail/Engine/InvoiceEmailEngine.php b/app/Mail/Engine/InvoiceEmailEngine.php index 79826b3a0345..70ab7ee7060f 100644 --- a/app/Mail/Engine/InvoiceEmailEngine.php +++ b/app/Mail/Engine/InvoiceEmailEngine.php @@ -135,31 +135,31 @@ class InvoiceEmailEngine extends BaseEmailEngine //attach third party documents if ($this->client->getSetting('document_email_attachment') !== false && $this->invoice->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) { if ($this->invoice->recurring_invoice()->exists()) { - foreach ($this->invoice->recurring_invoice->documents as $document) { + $this->invoice->recurring_invoice->documents()->where('is_public',true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); } // Storage::url - foreach ($this->invoice->documents as $document) { + $this->invoice->documents()->where('is_public',true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); - foreach ($this->invoice->company->documents as $document) { + $this->invoice->company->documents()->where('is_public',true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); $line_items = $this->invoice->line_items; @@ -175,13 +175,13 @@ class InvoiceEmailEngine extends BaseEmailEngine ->where('invoice_documents', 1) ->cursor() ->each(function ($expense) { - foreach ($expense->documents as $document) { + $expense->documents()->where('is_public',true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); }); } @@ -195,13 +195,13 @@ class InvoiceEmailEngine extends BaseEmailEngine $tasks = Task::query()->whereIn('id', $this->transformKeys($task_ids)) ->cursor() ->each(function ($task) { - foreach ($task->documents as $document) { + $task->documents()->where('is_public', true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); }); } } diff --git a/app/Mail/Engine/PaymentEmailEngine.php b/app/Mail/Engine/PaymentEmailEngine.php index 0e890e2165e7..400bef9b0618 100644 --- a/app/Mail/Engine/PaymentEmailEngine.php +++ b/app/Mail/Engine/PaymentEmailEngine.php @@ -98,13 +98,13 @@ class PaymentEmailEngine extends BaseEmailEngine //attach invoice documents also to payments if ($this->client->getSetting('document_email_attachment') !== false) { - foreach ($invoice->documents as $document) { + $invoice->documents()->where('is_public', true)->cursor()->each(function ($document){ if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); } if($this->client->getSetting('enable_e_invoice')) diff --git a/app/Mail/Engine/PurchaseOrderEmailEngine.php b/app/Mail/Engine/PurchaseOrderEmailEngine.php index 4bdd16f17e4a..51f6d5bd5360 100644 --- a/app/Mail/Engine/PurchaseOrderEmailEngine.php +++ b/app/Mail/Engine/PurchaseOrderEmailEngine.php @@ -127,21 +127,21 @@ class PurchaseOrderEmailEngine extends BaseEmailEngine //attach third party documents if ($this->vendor->getSetting('document_email_attachment') !== false && $this->purchase_order->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) { // Storage::url - foreach ($this->purchase_order->documents as $document) { + $this->purchase_order->documents()->where('is_public', true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); } - } + }); - foreach ($this->purchase_order->company->documents as $document) { + $this->purchase_order->company->documents()->where('is_public', true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['path' => $document->filePath(), 'name' => $document->name, 'mime' => null]]); } - } + }); } return $this; diff --git a/app/Mail/Engine/QuoteEmailEngine.php b/app/Mail/Engine/QuoteEmailEngine.php index 8e36291b0d42..72f3a13db1d7 100644 --- a/app/Mail/Engine/QuoteEmailEngine.php +++ b/app/Mail/Engine/QuoteEmailEngine.php @@ -121,21 +121,21 @@ class QuoteEmailEngine extends BaseEmailEngine //attach third party documents if ($this->client->getSetting('document_email_attachment') !== false && $this->quote->company->account->hasFeature(Account::FEATURE_DOCUMENTS)) { // Storage::url - foreach ($this->quote->documents as $document) { + $this->quote->documents()->where('is_public', true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); - foreach ($this->quote->company->documents as $document) { + $this->quote->company->documents()->where('is_public', true)->cursor()->each(function ($document) { if ($document->size > $this->max_attachment_size) { $this->setAttachmentLinks([" $document->hash]) ."'>". $document->name .""]); } else { $this->setAttachments([['file' => base64_encode($document->getFile()), 'path' => $document->filePath(), 'name' => $document->name, 'mime' => null, ]]); } - } + }); } return $this; diff --git a/app/Services/Email/EmailDefaults.php b/app/Services/Email/EmailDefaults.php index e2d833fa9e31..4e87b63a174b 100644 --- a/app/Services/Email/EmailDefaults.php +++ b/app/Services/Email/EmailDefaults.php @@ -365,7 +365,7 @@ class EmailDefaults ->where('invoice_documents', 1) ->cursor() ->each(function ($expense) { - $this->email->email_object->documents = array_merge($this->email->email_object->documents, $expense->documents->pluck('id')->toArray()); + $this->email->email_object->documents = array_merge($this->email->email_object->documents, $expense->documents()->where('is_public',true)->pluck('id')->toArray()); }); } @@ -373,7 +373,7 @@ class EmailDefaults Task::query()->whereIn('id', $this->transformKeys($task_ids)) ->cursor() ->each(function ($task) { - $this->email->email_object->documents = array_merge($this->email->email_object->documents, $task->documents->pluck('id')->toArray()); + $this->email->email_object->documents = array_merge($this->email->email_object->documents, $task->documents()->where('is_public',true)->pluck('id')->toArray()); }); } } diff --git a/lang/en/texts.php b/lang/en/texts.php index a5bc8f47feda..f957a2bfa232 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -657,8 +657,6 @@ $LANG = array( 'created_by_invoice' => 'Created by :invoice', 'primary_user' => 'Primary User', 'help' => 'Help', - 'customize_help' => '

We use :pdfmake_link to define the invoice designs declaratively. The pdfmake :playground_link provides a great way to see the library in action.

-

If you need help figuring something out post a question to our :forum_link with the design you\'re using.

', 'playground' => 'playground', 'support_forum' => 'Support Forums', 'invoice_due_date' => 'Due Date', @@ -1822,7 +1820,6 @@ $LANG = array( 'bot_emailed_notify_paid' => 'I\'ll email you when it\'s paid.', 'add_product_to_invoice' => 'Add 1 :product', 'not_authorized' => 'You are not authorized', - 'bot_get_email' => 'Hi! (wave)
Thanks for trying the Invoice Ninja Bot.
You need to create a free account to use this bot.
Send me your account email address to get started.', 'bot_get_code' => 'Thanks! I\'ve sent a you an email with your security code.', 'bot_welcome' => 'That\'s it, your account is verified.
', 'email_not_found' => 'I wasn\'t able to find an available account for :email', @@ -1830,7 +1827,6 @@ $LANG = array( 'security_code_email_subject' => 'Security code for Invoice Ninja Bot', 'security_code_email_line1' => 'This is your Invoice Ninja Bot security code.', 'security_code_email_line2' => 'Note: it will expire in 10 minutes.', - 'bot_help_message' => 'I currently support:
• Create\update\email an invoice
• List products
For example:
invoice bob for 2 tickets, set the due date to next thursday and the discount to 10 percent', 'list_products' => 'List Products', 'include_item_taxes_inline' => 'Include line item taxes in line total', @@ -1843,7 +1839,6 @@ $LANG = array( 'update_invoiceninja_warning' => 'Before start upgrading Invoice Ninja create a backup of your database and files!', 'update_invoiceninja_available' => 'A new version of Invoice Ninja is available.', 'update_invoiceninja_unavailable' => 'No new version of Invoice Ninja available.', - 'update_invoiceninja_instructions' => 'Please install the new version :version by clicking the Update now button below. Afterwards you\'ll be redirected to the dashboard.', 'update_invoiceninja_update_start' => 'Update now', 'update_invoiceninja_download_start' => 'Download :version', 'create_new' => 'Create New', @@ -5161,6 +5156,8 @@ $LANG = array( 'show_document_preview' => 'Show Document Preview', 'cash_accounting' => 'Cash accounting', 'click_or_drop_files_here' => 'Click or drop files here', + 'set_as_public' => 'Set as public', + 'set_as_private' => 'Set as private', ); return $LANG;