mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Working on invoice CSV import
This commit is contained in:
parent
04cc261987
commit
bc14df4658
@ -69,7 +69,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
'amount' => Invoice::$fieldAmount,
|
'amount' => Invoice::$fieldAmount,
|
||||||
'organization' => 'name',
|
'organization' => 'name',
|
||||||
'paid' => 'paid',
|
'paid' => 'paid',
|
||||||
'create_date' => Invoice::$fieldInvoiceDate,
|
'invoice_date' => Invoice::$fieldInvoiceDate,
|
||||||
'terms' => 'terms',
|
'terms' => 'terms',
|
||||||
'notes' => 'notes',
|
'notes' => 'notes',
|
||||||
];
|
];
|
||||||
|
@ -26,7 +26,7 @@ class InvoiceTransformer extends TransformerAbstract
|
|||||||
'po_number' => isset($data->po_number) ? $data->po_number : null,
|
'po_number' => isset($data->po_number) ? $data->po_number : null,
|
||||||
'terms' => isset($data->terms) ? $data->terms : null,
|
'terms' => isset($data->terms) ? $data->terms : null,
|
||||||
'public_notes' => isset($data->notes) ? $data->notes : null,
|
'public_notes' => isset($data->notes) ? $data->notes : null,
|
||||||
'invoice_date_sql' => isset($data->create_date) ? $data->create_date : null,
|
'invoice_date_sql' => isset($data->invoice_date) ? $data->invoice_date : null,
|
||||||
'invoice_items' => [
|
'invoice_items' => [
|
||||||
[
|
[
|
||||||
'notes' => isset($data->notes) ? $data->notes : null,
|
'notes' => isset($data->notes) ? $data->notes : null,
|
||||||
|
@ -10,7 +10,7 @@ class PaymentTransformer extends TransformerAbstract
|
|||||||
return new Item($data, function ($data) use ($maps) {
|
return new Item($data, function ($data) use ($maps) {
|
||||||
return [
|
return [
|
||||||
'amount' => $data->paid,
|
'amount' => $data->paid,
|
||||||
'payment_date_sql' => $data->create_date,
|
'payment_date_sql' => isset($data->invoice_date) ? $data->invoice_date : null,
|
||||||
'client_id' => $data->client_id,
|
'client_id' => $data->client_id,
|
||||||
'invoice_id' => $data->invoice_id,
|
'invoice_id' => $data->invoice_id,
|
||||||
];
|
];
|
||||||
|
@ -112,6 +112,12 @@ class ImportService
|
|||||||
|
|
||||||
$data = $this->fractal->createData($resource)->toArray();
|
$data = $this->fractal->createData($resource)->toArray();
|
||||||
|
|
||||||
|
if (!$data['invoice_number']) {
|
||||||
|
$account = Auth::user()->account;
|
||||||
|
$invoice = Invoice::createNew();
|
||||||
|
$data['invoice_number'] = $account->getNextInvoiceNumber($invoice);
|
||||||
|
}
|
||||||
|
|
||||||
if ($this->validate($data, $entityType) !== true) {
|
if ($this->validate($data, $entityType) !== true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user