1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00

Fixed to bulk download

This commit is contained in:
Hillel Coren 2017-07-19 17:34:09 +03:00
parent 047a0fb2be
commit 84b6b7b928
8 changed files with 27 additions and 6 deletions

View File

@ -480,6 +480,8 @@ class InvoiceController extends BaseController
$key = 'emailed_' . $entityType; $key = 'emailed_' . $entityType;
} elseif ($action == 'markPaid') { } elseif ($action == 'markPaid') {
$key = 'created_payment'; $key = 'created_payment';
} elseif ($action == 'download') {
$key = 'downloaded_invoice';
} else { } else {
$key = "{$action}d_{$entityType}"; $key = "{$action}d_{$entityType}";
} }

View File

@ -133,7 +133,13 @@ class QuoteController extends BaseController
$count = $this->invoiceService->bulk($ids, $action); $count = $this->invoiceService->bulk($ids, $action);
if ($count > 0) { 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); $message = Utils::pluralize($key, $count);
Session::flash('message', $message); Session::flash('message', $message);
} }

View File

@ -916,7 +916,7 @@ class Utils
$str = ''; $str = '';
if (property_exists($model, 'is_deleted')) { 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) { if ($model->is_deleted) {
$str .= 'ENTITY_DELETED '; $str .= 'ENTITY_DELETED ';

View File

@ -181,10 +181,9 @@ class InvoiceDatatable extends EntityDatatable
public function bulkActions() public function bulkActions()
{ {
$actions = parent::bulkActions(); $actions = [];
if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) { if ($this->entityType == ENTITY_INVOICE || $this->entityType == ENTITY_QUOTE) {
$actions[] = \DropdownButton::DIVIDER;
$actions[] = [ $actions[] = [
'label' => mtrans($this->entityType, 'download_' . $this->entityType), 'label' => mtrans($this->entityType, 'download_' . $this->entityType),
'url' => 'javascript:submitForm_'.$this->entityType.'("download")', '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; return $actions;
} }
} }

View File

@ -78,7 +78,8 @@ class DatatableService
$dropdown_contents = ''; $dropdown_contents = '';
$lastIsDivider = false; $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) { foreach ($datatable->actions() as $action) {
if (count($action)) { if (count($action)) {
// if show function isn't set default to true // if show function isn't set default to true

View File

@ -66,6 +66,7 @@ class InvoiceService extends BaseService
if ($action == 'download') { if ($action == 'download') {
$invoices = $this->getRepo()->findByPublicIdsWithTrashed($ids); $invoices = $this->getRepo()->findByPublicIdsWithTrashed($ids);
dispatch(new DownloadInvoices(Auth::user(), $invoices)); dispatch(new DownloadInvoices(Auth::user(), $invoices));
return count($invoices);
} else { } else {
return parent::bulk($ids, $action); return parent::bulk($ids, $action);
} }

View File

@ -2311,6 +2311,10 @@ $LANG = array(
'download_invoice' => 'Download Invoice', 'download_invoice' => 'Download Invoice',
'download_quote' => 'Download Quote', 'download_quote' => 'Download Quote',
'invoices_are_attached' => 'Your invoice PDFs are attached.', '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',
); );

View File

@ -189,7 +189,12 @@
<body class="body"> <body class="body">
@if (Utils::isNinjaProd() && isset($_ENV['TAG_MANAGER_KEY']) && $_ENV['TAG_MANAGER_KEY']) @if (request()->phantomjs)
<script>
function trackEvent(category, action) {
}
</script>
@elseif (Utils::isNinjaProd() && isset($_ENV['TAG_MANAGER_KEY']) && $_ENV['TAG_MANAGER_KEY'])
<!-- Google Tag Manager --> <!-- Google Tag Manager -->
<noscript> <noscript>
<iframe src="//www.googletagmanager.com/ns.html?id={{ $_ENV['TAG_MANAGER_KEY'] }}" <iframe src="//www.googletagmanager.com/ns.html?id={{ $_ENV['TAG_MANAGER_KEY'] }}"