diff --git a/CHANGELOG.md b/CHANGELOG.md index 25b7340480..8b248db721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,8 +10,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - Removed `invoiceninja.komodoproject` from Git #932 -- `APP_CIPHER` changed from `rinjdael-128` to `AES-256-CBC` #898 +- `APP_CIPHER` changed from `rinjdael-128` to `AES-256-CBC` #898 +- Improved options when exporting data ### Fixed - "Manual entry" untranslatable #562 -- Using a database table prefix breaks the dashboard #203 \ No newline at end of file +- Using a database table prefix breaks the dashboard #203 diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.php index 41b28ffb13..c4467b4ac3 100644 --- a/app/Http/Controllers/ExportController.php +++ b/app/Http/Controllers/ExportController.php @@ -150,44 +150,52 @@ class ExportController extends BaseController 'multiUser' => $account->users->count() > 1 ]; - if ($request->input(ENTITY_CLIENT)) { + if ($request->input('include') === 'all' || $request->input('clients')) { $data['clients'] = Client::scope() ->with('user', 'contacts', 'country') ->withArchived() ->get(); + } + if ($request->input('include') === 'all' || $request->input('contacts')) { $data['contacts'] = Contact::scope() ->with('user', 'client.contacts') ->withTrashed() ->get(); + } + if ($request->input('include') === 'all' || $request->input('credits')) { $data['credits'] = Credit::scope() ->with('user', 'client.contacts') ->get(); } - if ($request->input(ENTITY_TASK)) { + if ($request->input('include') === 'all' || $request->input('tasks')) { $data['tasks'] = Task::scope() ->with('user', 'client.contacts') ->withArchived() ->get(); } - if ($request->input(ENTITY_INVOICE)) { + if ($request->input('include') === 'all' || $request->input('invoices')) { $data['invoices'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_STANDARD) ->with('user', 'client.contacts', 'invoice_status') ->withArchived() ->where('is_recurring', '=', false) ->get(); + } + if ($request->input('include') === 'all' || $request->input('quotes')) { $data['quotes'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_QUOTE) ->with('user', 'client.contacts', 'invoice_status') ->withArchived() ->where('is_recurring', '=', false) ->get(); + } + if ($request->input('include') === 'all' || $request->input('recurring')) { $data['recurringInvoices'] = Invoice::scope() ->invoiceType(INVOICE_TYPE_STANDARD) ->with('user', 'client.contacts', 'invoice_status', 'frequency') @@ -196,20 +204,21 @@ class ExportController extends BaseController ->get(); } - if ($request->input(ENTITY_PAYMENT)) { + if ($request->input('include') === 'all' || $request->input('payments')) { $data['payments'] = Payment::scope() ->withArchived() ->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway') ->get(); } - - if ($request->input(ENTITY_VENDOR)) { - $data['clients'] = Vendor::scope() + if ($request->input('include') === 'all' || $request->input('vendors')) { + $data['vendors'] = Vendor::scope() ->with('user', 'vendor_contacts', 'country') ->withArchived() ->get(); + } + if ($request->input('include') === 'all' || $request->input('vendor_contacts')) { $data['vendor_contacts'] = VendorContact::scope() ->with('user', 'vendor.vendor_contacts') ->withTrashed() diff --git a/config/app.php b/config/app.php index 62ab555d2e..4068375778 100644 --- a/config/app.php +++ b/config/app.php @@ -119,6 +119,7 @@ return [ */ 'Illuminate\Auth\AuthServiceProvider', 'Collective\Html\HtmlServiceProvider', + 'Collective\Bus\BusServiceProvider', 'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Cookie\CookieServiceProvider', diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 09c2dcd69b..0d872b9eea 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2006,6 +2006,10 @@ $LANG = array( 'view_client_portal' => 'View client portal', 'view_portal' => 'View Portal', + 'vendor_contacts' => 'Vendor Contacts', + 'all' => 'All', + 'selected' => 'Selected', + ); return $LANG; diff --git a/resources/views/accounts/import_export.blade.php b/resources/views/accounts/import_export.blade.php index 93acd555e8..ee21bcd673 100644 --- a/resources/views/accounts/import_export.blade.php +++ b/resources/views/accounts/import_export.blade.php @@ -56,15 +56,33 @@ ->style('max-width: 200px') ->inlineHelp('export_help') !!} - {!! Former::checkbox('entity_types') - ->label('include') - ->addGroupClass('entity-types') - ->checkboxes([ - trans('texts.clients') => array('name' => ENTITY_CLIENT, 'value' => 1), - trans('texts.tasks') => array('name' => ENTITY_TASK, 'value' => 1), - trans('texts.invoices') => array('name' => ENTITY_INVOICE, 'value' => 1), - trans('texts.payments') => array('name' => ENTITY_PAYMENT, 'value' => 1), - ])->check(ENTITY_CLIENT)->check(ENTITY_TASK)->check(ENTITY_INVOICE)->check(ENTITY_PAYMENT) !!} + + {!! Former::inline_radios('include_radio') + ->onchange('onIncludeChange()') + ->label(trans('texts.include')) + ->radios([ + trans('texts.all') => ['value' => 'all', 'name' => 'include'], + trans('texts.selected') => ['value' => 'selected', 'name' => 'include'], + ])->check('all') !!} + + +