1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 00:53:10 +01:00

Improved options when exporting data

This commit is contained in:
Hillel Coren 2016-07-05 16:09:52 +03:00
parent 81898338e0
commit 979690d116
8 changed files with 139 additions and 18 deletions

View File

@ -10,8 +10,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed ### Changed
- Removed `invoiceninja.komodoproject` from Git #932 - 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 ### Fixed
- "Manual entry" untranslatable #562 - "Manual entry" untranslatable #562
- Using a database table prefix breaks the dashboard #203 - Using a database table prefix breaks the dashboard #203

View File

@ -150,44 +150,52 @@ class ExportController extends BaseController
'multiUser' => $account->users->count() > 1 'multiUser' => $account->users->count() > 1
]; ];
if ($request->input(ENTITY_CLIENT)) { if ($request->input('include') === 'all' || $request->input('clients')) {
$data['clients'] = Client::scope() $data['clients'] = Client::scope()
->with('user', 'contacts', 'country') ->with('user', 'contacts', 'country')
->withArchived() ->withArchived()
->get(); ->get();
}
if ($request->input('include') === 'all' || $request->input('contacts')) {
$data['contacts'] = Contact::scope() $data['contacts'] = Contact::scope()
->with('user', 'client.contacts') ->with('user', 'client.contacts')
->withTrashed() ->withTrashed()
->get(); ->get();
}
if ($request->input('include') === 'all' || $request->input('credits')) {
$data['credits'] = Credit::scope() $data['credits'] = Credit::scope()
->with('user', 'client.contacts') ->with('user', 'client.contacts')
->get(); ->get();
} }
if ($request->input(ENTITY_TASK)) { if ($request->input('include') === 'all' || $request->input('tasks')) {
$data['tasks'] = Task::scope() $data['tasks'] = Task::scope()
->with('user', 'client.contacts') ->with('user', 'client.contacts')
->withArchived() ->withArchived()
->get(); ->get();
} }
if ($request->input(ENTITY_INVOICE)) { if ($request->input('include') === 'all' || $request->input('invoices')) {
$data['invoices'] = Invoice::scope() $data['invoices'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_STANDARD) ->invoiceType(INVOICE_TYPE_STANDARD)
->with('user', 'client.contacts', 'invoice_status') ->with('user', 'client.contacts', 'invoice_status')
->withArchived() ->withArchived()
->where('is_recurring', '=', false) ->where('is_recurring', '=', false)
->get(); ->get();
}
if ($request->input('include') === 'all' || $request->input('quotes')) {
$data['quotes'] = Invoice::scope() $data['quotes'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_QUOTE) ->invoiceType(INVOICE_TYPE_QUOTE)
->with('user', 'client.contacts', 'invoice_status') ->with('user', 'client.contacts', 'invoice_status')
->withArchived() ->withArchived()
->where('is_recurring', '=', false) ->where('is_recurring', '=', false)
->get(); ->get();
}
if ($request->input('include') === 'all' || $request->input('recurring')) {
$data['recurringInvoices'] = Invoice::scope() $data['recurringInvoices'] = Invoice::scope()
->invoiceType(INVOICE_TYPE_STANDARD) ->invoiceType(INVOICE_TYPE_STANDARD)
->with('user', 'client.contacts', 'invoice_status', 'frequency') ->with('user', 'client.contacts', 'invoice_status', 'frequency')
@ -196,20 +204,21 @@ class ExportController extends BaseController
->get(); ->get();
} }
if ($request->input(ENTITY_PAYMENT)) { if ($request->input('include') === 'all' || $request->input('payments')) {
$data['payments'] = Payment::scope() $data['payments'] = Payment::scope()
->withArchived() ->withArchived()
->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway') ->with('user', 'client.contacts', 'payment_type', 'invoice', 'account_gateway.gateway')
->get(); ->get();
} }
if ($request->input('include') === 'all' || $request->input('vendors')) {
if ($request->input(ENTITY_VENDOR)) { $data['vendors'] = Vendor::scope()
$data['clients'] = Vendor::scope()
->with('user', 'vendor_contacts', 'country') ->with('user', 'vendor_contacts', 'country')
->withArchived() ->withArchived()
->get(); ->get();
}
if ($request->input('include') === 'all' || $request->input('vendor_contacts')) {
$data['vendor_contacts'] = VendorContact::scope() $data['vendor_contacts'] = VendorContact::scope()
->with('user', 'vendor.vendor_contacts') ->with('user', 'vendor.vendor_contacts')
->withTrashed() ->withTrashed()

View File

@ -119,6 +119,7 @@ return [
*/ */
'Illuminate\Auth\AuthServiceProvider', 'Illuminate\Auth\AuthServiceProvider',
'Collective\Html\HtmlServiceProvider', 'Collective\Html\HtmlServiceProvider',
'Collective\Bus\BusServiceProvider',
'Illuminate\Cache\CacheServiceProvider', 'Illuminate\Cache\CacheServiceProvider',
'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider',
'Illuminate\Cookie\CookieServiceProvider', 'Illuminate\Cookie\CookieServiceProvider',

View File

@ -2006,6 +2006,10 @@ $LANG = array(
'view_client_portal' => 'View client portal', 'view_client_portal' => 'View client portal',
'view_portal' => 'View Portal', 'view_portal' => 'View Portal',
'vendor_contacts' => 'Vendor Contacts',
'all' => 'All',
'selected' => 'Selected',
); );
return $LANG; return $LANG;

View File

@ -56,15 +56,33 @@
->style('max-width: 200px') ->style('max-width: 200px')
->inlineHelp('export_help') !!} ->inlineHelp('export_help') !!}
{!! Former::checkbox('entity_types')
->label('include') {!! Former::inline_radios('include_radio')
->addGroupClass('entity-types') ->onchange('onIncludeChange()')
->checkboxes([ ->label(trans('texts.include'))
trans('texts.clients') => array('name' => ENTITY_CLIENT, 'value' => 1), ->radios([
trans('texts.tasks') => array('name' => ENTITY_TASK, 'value' => 1), trans('texts.all') => ['value' => 'all', 'name' => 'include'],
trans('texts.invoices') => array('name' => ENTITY_INVOICE, 'value' => 1), trans('texts.selected') => ['value' => 'selected', 'name' => 'include'],
trans('texts.payments') => array('name' => ENTITY_PAYMENT, 'value' => 1), ])->check('all') !!}
])->check(ENTITY_CLIENT)->check(ENTITY_TASK)->check(ENTITY_INVOICE)->check(ENTITY_PAYMENT) !!}
<div class="form-group entity-types">
<label class="control-label col-lg-4 col-sm-4"></label>
<div class="col-lg-3 col-sm-2">
@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'])
</div>
<div class="col-lg-3 col-sm-3">
@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'])
</div>
</div>
{!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!} {!! Former::actions( Button::primary(trans('texts.download'))->submit()->large()->appendIcon(Icon::create('download-alt'))) !!}
</div> </div>
@ -75,6 +93,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
setFileTypesVisible(); setFileTypesVisible();
onIncludeChange();
}); });
function setEntityTypesVisible() { function setEntityTypesVisible() {
@ -109,6 +128,16 @@
@endforeach @endforeach
} }
function onIncludeChange() {
var $checkboxes = $('input[type=checkbox]');
var val = $('input[name=include]:checked').val()
if (val == 'all') {
$checkboxes.attr('disabled', true);
} else {
$checkboxes.removeAttr('disabled');
}
}
</script> </script>
@stop @stop

View File

@ -0,0 +1,27 @@
<tr>
<td>{{ trans('texts.client') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.first_name') }}</td>
<td>{{ trans('texts.last_name') }}</td>
<td>{{ trans('texts.email') }}</td>
<td>{{ trans('texts.phone') }}</td>
</tr>
@foreach ($contacts as $contact)
@if (!$contact->client->is_deleted)
<tr>
<td>{{ $contact->client->getDisplayName() }}</td>
@if ($multiUser)
<td>{{ $contact->user->getDisplayName() }}</td>
@endif
<td>{{ $contact->first_name }}</td>
<td>{{ $contact->last_name }}</td>
<td>{{ $contact->email }}</td>
<td>{{ $contact->phone }}</td>
</tr>
@endif
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,45 @@
<tr>
<td>{{ trans('texts.name') }}</td>
@if ($multiUser)
<td>{{ trans('texts.user') }}</td>
@endif
<td>{{ trans('texts.balance') }}</td>
<td>{{ trans('texts.paid_to_date') }}</td>
<td>{{ trans('texts.address1') }}</td>
<td>{{ trans('texts.address2') }}</td>
<td>{{ trans('texts.city') }}</td>
<td>{{ trans('texts.state') }}</td>
<td>{{ trans('texts.postal_code') }}</td>
<td>{{ trans('texts.country') }}</td>
@if ($account->custom_client_label1)
<td>{{ $account->custom_client_label1 }}</td>
@endif
@if ($account->custom_client_label2)
<td>{{ $account->custom_client_label2 }}</td>
@endif
</tr>
@foreach ($clients as $client)
<tr>
<td>{{ $client->getDisplayName() }}</td>
@if ($multiUser)
<td>{{ $client->user->getDisplayName() }}</td>
@endif
<td>{{ $account->formatMoney($client->balance, $client) }}</td>
<td>{{ $account->formatMoney($client->paid_to_date, $client) }}</td>
<td>{{ $client->address1 }}</td>
<td>{{ $client->address2 }}</td>
<td>{{ $client->city }}</td>
<td>{{ $client->state }}</td>
<td>{{ $client->postal_code }}</td>
<td>{{ $client->present()->country }}</td>
@if ($account->custom_client_label1)
<td>{{ $client->custom_value1 }}</td>
@endif
@if ($account->custom_client_label2)
<td>{{ $client->custom_value2 }}</td>
@endif
</tr>
@endforeach
<tr><td></td></tr>

View File

@ -0,0 +1,5 @@
<div class="checkbox">
<label for="{{ $field }}" class="">
<input value="1" id="{{ $field }}" type="checkbox" name="{{ $field }}">{{ trans("texts.{$field}") }}
</label>
</div>