mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Improvements to CSV import/export
This commit is contained in:
parent
923bea823e
commit
c8419c14d1
@ -32,7 +32,21 @@ class ExportController extends BaseController
|
|||||||
{
|
{
|
||||||
$format = $request->input('format');
|
$format = $request->input('format');
|
||||||
$date = date('Y-m-d');
|
$date = date('Y-m-d');
|
||||||
$fileName = "invoice-ninja-{$date}";
|
|
||||||
|
// set the filename based on the entity types selected
|
||||||
|
if ($request->include == 'all') {
|
||||||
|
$fileName = "invoice-ninja-{$date}";
|
||||||
|
} else {
|
||||||
|
$fields = $request->all();
|
||||||
|
$fields = array_filter(array_map(function ($key) {
|
||||||
|
if ( ! in_array($key, ['format', 'include', '_token'])) {
|
||||||
|
return $key;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}, array_keys($fields), $fields));
|
||||||
|
$fileName = "invoice-ninja-" . join('-', $fields) . "-{$date}";
|
||||||
|
}
|
||||||
|
|
||||||
if ($format === 'JSON') {
|
if ($format === 'JSON') {
|
||||||
return $this->returnJSON($request, $fileName);
|
return $this->returnJSON($request, $fileName);
|
||||||
|
@ -77,6 +77,10 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public static $fieldInvoiceNumber = 'invoice_number';
|
public static $fieldInvoiceNumber = 'invoice_number';
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
public static $fieldPONumber = 'po_number';
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
@ -110,6 +114,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return [
|
return [
|
||||||
Client::$fieldName,
|
Client::$fieldName,
|
||||||
Invoice::$fieldInvoiceNumber,
|
Invoice::$fieldInvoiceNumber,
|
||||||
|
Invoice::$fieldPONumber,
|
||||||
Invoice::$fieldInvoiceDate,
|
Invoice::$fieldInvoiceDate,
|
||||||
Invoice::$fieldDueDate,
|
Invoice::$fieldDueDate,
|
||||||
Invoice::$fieldAmount,
|
Invoice::$fieldAmount,
|
||||||
@ -127,9 +132,11 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return [
|
return [
|
||||||
'number^po' => 'invoice_number',
|
'number^po' => 'invoice_number',
|
||||||
'amount' => 'amount',
|
'amount' => 'amount',
|
||||||
'organization' => 'name',
|
'client|organization' => 'name',
|
||||||
'paid^date' => 'paid',
|
'paid^date' => 'paid',
|
||||||
'invoice_date|create_date' => 'invoice_date',
|
'invoice date|create date' => 'invoice_date',
|
||||||
|
'po number' => 'po_number',
|
||||||
|
'due date' => 'due_date',
|
||||||
'terms' => 'terms',
|
'terms' => 'terms',
|
||||||
'notes' => 'notes',
|
'notes' => 'notes',
|
||||||
];
|
];
|
||||||
|
@ -2317,6 +2317,7 @@ $LANG = array(
|
|||||||
'domain_help' => 'Used in the client portal and when sending emails.',
|
'domain_help' => 'Used in the client portal and when sending emails.',
|
||||||
'domain_help_website' => 'Used when sending emails.',
|
'domain_help_website' => 'Used when sending emails.',
|
||||||
'preview' => 'Preview',
|
'preview' => 'Preview',
|
||||||
|
'import_invoices' => 'Import Invoices',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<td>{{ trans('texts.user') }}</td>
|
<td>{{ trans('texts.user') }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_number' : 'texts.invoice_number') }}</td>
|
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_number' : 'texts.invoice_number') }}</td>
|
||||||
<td>{{ trans('texts.balance') }}</td>
|
|
||||||
<td>{{ trans('texts.amount') }}</td>
|
<td>{{ trans('texts.amount') }}</td>
|
||||||
|
<td>{{ trans('texts.paid') }}</td>
|
||||||
<td>{{ trans('texts.po_number') }}</td>
|
<td>{{ trans('texts.po_number') }}</td>
|
||||||
<td>{{ trans('texts.status') }}</td>
|
<td>{{ trans('texts.status') }}</td>
|
||||||
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_date' : 'texts.invoice_date') }}</td>
|
<td>{{ trans(isset($entityType) && $entityType == ENTITY_QUOTE ? 'texts.quote_date' : 'texts.invoice_date') }}</td>
|
||||||
@ -34,8 +34,8 @@
|
|||||||
<td>{{ $invoice->present()->user }}</td>
|
<td>{{ $invoice->present()->user }}</td>
|
||||||
@endif
|
@endif
|
||||||
<td>{{ $invoice->invoice_number }}</td>
|
<td>{{ $invoice->invoice_number }}</td>
|
||||||
<td>{{ $account->formatMoney($invoice->balance, $invoice->client) }}</td>
|
|
||||||
<td>{{ $account->formatMoney($invoice->amount, $invoice->client) }}</td>
|
<td>{{ $account->formatMoney($invoice->amount, $invoice->client) }}</td>
|
||||||
|
<td>{{ $account->formatMoney($invoice->amount - $invoice->balance, $invoice->client) }}</td>
|
||||||
<td>{{ $invoice->po_number }}</td>
|
<td>{{ $invoice->po_number }}</td>
|
||||||
<td>{{ $invoice->present()->status }}</td>
|
<td>{{ $invoice->present()->status }}</td>
|
||||||
<td>{{ $invoice->present()->invoice_date }}</td>
|
<td>{{ $invoice->present()->invoice_date }}</td>
|
||||||
@ -56,4 +56,4 @@
|
|||||||
@endif
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
<tr><td></td></tr>
|
<tr><td></td></tr>
|
||||||
|
Loading…
Reference in New Issue
Block a user