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') !!} + + +
+ +
+ @include('partials/checkbox', ['field' => 'clients']) + @include('partials/checkbox', ['field' => 'contacts']) + @include('partials/checkbox', ['field' => 'credits']) + @include('partials/checkbox', ['field' => 'tasks']) + @include('partials/checkbox', ['field' => 'invoices']) +
+
+ @include('partials/checkbox', ['field' => 'quotes']) + @include('partials/checkbox', ['field' => 'recurring']) + @include('partials/checkbox', ['field' => 'payments']) + @include('partials/checkbox', ['field' => 'vendors']) + @include('partials/checkbox', ['field' => 'vendor_contacts']) +
+
{!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!} @@ -75,6 +93,7 @@ @stop diff --git a/resources/views/export/vendor_contacts.blade.php b/resources/views/export/vendor_contacts.blade.php new file mode 100644 index 0000000000..b35f59045a --- /dev/null +++ b/resources/views/export/vendor_contacts.blade.php @@ -0,0 +1,27 @@ + + {{ trans('texts.client') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.first_name') }} + {{ trans('texts.last_name') }} + {{ trans('texts.email') }} + {{ trans('texts.phone') }} + + +@foreach ($contacts as $contact) + @if (!$contact->client->is_deleted) + + {{ $contact->client->getDisplayName() }} + @if ($multiUser) + {{ $contact->user->getDisplayName() }} + @endif + {{ $contact->first_name }} + {{ $contact->last_name }} + {{ $contact->email }} + {{ $contact->phone }} + + @endif +@endforeach + + \ No newline at end of file diff --git a/resources/views/export/vendors.blade.php b/resources/views/export/vendors.blade.php new file mode 100644 index 0000000000..f0d2a05b75 --- /dev/null +++ b/resources/views/export/vendors.blade.php @@ -0,0 +1,45 @@ + + {{ trans('texts.name') }} + @if ($multiUser) + {{ trans('texts.user') }} + @endif + {{ trans('texts.balance') }} + {{ trans('texts.paid_to_date') }} + {{ trans('texts.address1') }} + {{ trans('texts.address2') }} + {{ trans('texts.city') }} + {{ trans('texts.state') }} + {{ trans('texts.postal_code') }} + {{ trans('texts.country') }} + @if ($account->custom_client_label1) + {{ $account->custom_client_label1 }} + @endif + @if ($account->custom_client_label2) + {{ $account->custom_client_label2 }} + @endif + + +@foreach ($clients as $client) + + {{ $client->getDisplayName() }} + @if ($multiUser) + {{ $client->user->getDisplayName() }} + @endif + {{ $account->formatMoney($client->balance, $client) }} + {{ $account->formatMoney($client->paid_to_date, $client) }} + {{ $client->address1 }} + {{ $client->address2 }} + {{ $client->city }} + {{ $client->state }} + {{ $client->postal_code }} + {{ $client->present()->country }} + @if ($account->custom_client_label1) + {{ $client->custom_value1 }} + @endif + @if ($account->custom_client_label2) + {{ $client->custom_value2 }} + @endif + +@endforeach + + \ No newline at end of file diff --git a/resources/views/partials/checkbox.blade.php b/resources/views/partials/checkbox.blade.php new file mode 100644 index 0000000000..337cf235d3 --- /dev/null +++ b/resources/views/partials/checkbox.blade.php @@ -0,0 +1,5 @@ +
+ +