Support bulk emailing

This commit is contained in:
Hillel Coren 2017-01-11 15:53:26 +02:00
parent 457dcf67bc
commit 318b189bc0
4 changed files with 18 additions and 1 deletions

View File

@ -521,6 +521,8 @@ class InvoiceController extends BaseController
if ($count > 0) {
if ($action == 'markSent') {
$key = 'marked_sent_invoice';
} elseif ($action == 'emailInvoice') {
$key = 'emailed_' . $entityType;
} elseif ($action == 'markPaid') {
$key = 'created_payment';
} else {

View File

@ -180,6 +180,10 @@ class InvoiceDatatable extends EntityDatatable
if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) {
$actions[] = \DropdownButton::DIVIDER;
$actions[] = [
'label' => mtrans($this->entityType, 'email_' . $this->entityType),
'url' => 'javascript:submitForm_'.$this->entityType.'("emailInvoice")',
];
$actions[] = [
'label' => mtrans($this->entityType, 'mark_sent'),
'url' => 'javascript:submitForm_'.$this->entityType.'("markSent")',

View File

@ -12,6 +12,7 @@ use App\Models\Task;
use App\Models\Document;
use App\Models\Expense;
use App\Services\PaymentService;
use App\Jobs\SendInvoiceEmail;
class InvoiceRepository extends BaseRepository
{
@ -746,6 +747,15 @@ class InvoiceRepository extends BaseRepository
return $clone;
}
/**
* @param Invoice $invoice
*/
public function emailInvoice(Invoice $invoice)
{
dispatch(new SendInvoiceEmail($invoice));
}
/**
* @param Invoice $invoice
*/

View File

@ -2310,7 +2310,8 @@ $LANG = array(
'bcc_email_help' => 'All emails sent to your clients will also be sent to this address.',
'tax_quote' => 'Tax Quote',
'tax_invoice' => 'Tax Invoice',
'emailed_invoices' => 'Successfully emailed invoices',
'emailed_quotes' => 'Successfully emailed quotes',
);
return $LANG;