diff --git a/app/Http/Controllers/InvoiceController.php b/app/Http/Controllers/InvoiceController.php index 902ffcf613..b883f6f474 100644 --- a/app/Http/Controllers/InvoiceController.php +++ b/app/Http/Controllers/InvoiceController.php @@ -480,6 +480,8 @@ class InvoiceController extends BaseController $key = 'emailed_' . $entityType; } elseif ($action == 'markPaid') { $key = 'created_payment'; + } elseif ($action == 'download') { + $key = 'downloaded_invoice'; } else { $key = "{$action}d_{$entityType}"; } diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 264b2f7acb..35ccb47fd7 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -133,7 +133,13 @@ class QuoteController extends BaseController $count = $this->invoiceService->bulk($ids, $action); if ($count > 0) { - $key = $action == 'markSent' ? 'updated_quote' : "{$action}d_quote"; + if ($action == 'markSent') { + $key = 'updated_quote'; + } elseif ($action == 'download') { + $key = 'downloaded_quote'; + } else { + $key = "{$action}d_quote"; + } $message = Utils::pluralize($key, $count); Session::flash('message', $message); } diff --git a/app/Libraries/Utils.php b/app/Libraries/Utils.php index df0c26a8a9..108a077936 100644 --- a/app/Libraries/Utils.php +++ b/app/Libraries/Utils.php @@ -916,7 +916,7 @@ class Utils $str = ''; if (property_exists($model, 'is_deleted')) { - $str = $model->is_deleted || ($model->deleted_at && $model->deleted_at != '0000-00-00') ? 'DISABLED ' : ''; + $str = $model->is_deleted ? 'DISABLED ' : ''; if ($model->is_deleted) { $str .= 'ENTITY_DELETED '; diff --git a/app/Ninja/Datatables/InvoiceDatatable.php b/app/Ninja/Datatables/InvoiceDatatable.php index 35da042591..efbd4e9905 100644 --- a/app/Ninja/Datatables/InvoiceDatatable.php +++ b/app/Ninja/Datatables/InvoiceDatatable.php @@ -181,10 +181,9 @@ class InvoiceDatatable extends EntityDatatable public function bulkActions() { - $actions = parent::bulkActions(); + $actions = []; if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) { - $actions[] = \DropdownButton::DIVIDER; $actions[] = [ 'label' => mtrans($this->entityType, 'download_' . $this->entityType), 'url' => 'javascript:submitForm_'.$this->entityType.'("download")', @@ -207,6 +206,9 @@ class InvoiceDatatable extends EntityDatatable ]; } + $actions[] = \DropdownButton::DIVIDER; + $actions = array_merge($actions, parent::bulkActions()); + return $actions; } } diff --git a/app/Services/DatatableService.php b/app/Services/DatatableService.php index 44fa83bf3f..fa5deabb2a 100644 --- a/app/Services/DatatableService.php +++ b/app/Services/DatatableService.php @@ -78,7 +78,8 @@ class DatatableService $dropdown_contents = ''; $lastIsDivider = false; - if (! $model->deleted_at || $model->deleted_at == '0000-00-00') { + //if (! $model->deleted_at || $model->deleted_at == '0000-00-00') { + if (! $model->is_deleted) { foreach ($datatable->actions() as $action) { if (count($action)) { // if show function isn't set default to true diff --git a/app/Services/InvoiceService.php b/app/Services/InvoiceService.php index 5eb2eaaf18..282fd00a85 100644 --- a/app/Services/InvoiceService.php +++ b/app/Services/InvoiceService.php @@ -66,6 +66,7 @@ class InvoiceService extends BaseService if ($action == 'download') { $invoices = $this->getRepo()->findByPublicIdsWithTrashed($ids); dispatch(new DownloadInvoices(Auth::user(), $invoices)); + return count($invoices); } else { return parent::bulk($ids, $action); } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index abc8104c63..7925179434 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2311,6 +2311,10 @@ $LANG = array( 'download_invoice' => 'Download Invoice', 'download_quote' => 'Download Quote', 'invoices_are_attached' => 'Your invoice PDFs are attached.', + 'downloaded_invoice' => 'An email will be sent with the invoice PDF', + 'downloaded_quote' => 'An email will be sent with the quote PDF', + 'downloaded_invoices' => 'An email will be sent with the invoice PDFs', + 'downloaded_quotes' => 'An email will be sent with the quote PDFs', ); diff --git a/resources/views/master.blade.php b/resources/views/master.blade.php index 41469bff62..2abf447e20 100644 --- a/resources/views/master.blade.php +++ b/resources/views/master.blade.php @@ -189,7 +189,12 @@ -@if (Utils::isNinjaProd() && isset($_ENV['TAG_MANAGER_KEY']) && $_ENV['TAG_MANAGER_KEY']) +@if (request()->phantomjs) + +@elseif (Utils::isNinjaProd() && isset($_ENV['TAG_MANAGER_KEY']) && $_ENV['TAG_MANAGER_KEY'])