mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 17:54:30 -04:00
Importing payments.csv from Wave fails #1717
This commit is contained in:
parent
f6d8ae4326
commit
e62213d221
@ -30,7 +30,7 @@ class CreatePaymentAPIRequest extends PaymentRequest
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->invoice = $invoice = Invoice::scope($this->invoice_id)
|
$this->invoice = $invoice = Invoice::scope($this->invoice_public_id ?: $this->invoice_id)
|
||||||
->withArchived()
|
->withArchived()
|
||||||
->invoices()
|
->invoices()
|
||||||
->first();
|
->first();
|
||||||
|
@ -259,10 +259,21 @@ class BaseTransformer extends TransformerAbstract
|
|||||||
{
|
{
|
||||||
$invoiceNumber = $this->getInvoiceNumber($invoiceNumber);
|
$invoiceNumber = $this->getInvoiceNumber($invoiceNumber);
|
||||||
$invoiceNumber = strtolower($invoiceNumber);
|
$invoiceNumber = strtolower($invoiceNumber);
|
||||||
|
|
||||||
return isset($this->maps[ENTITY_INVOICE][$invoiceNumber]) ? $this->maps[ENTITY_INVOICE][$invoiceNumber] : null;
|
return isset($this->maps[ENTITY_INVOICE][$invoiceNumber]) ? $this->maps[ENTITY_INVOICE][$invoiceNumber] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $invoiceNumber
|
||||||
|
*
|
||||||
|
* @return null
|
||||||
|
*/
|
||||||
|
public function getInvoicePublicId($invoiceNumber)
|
||||||
|
{
|
||||||
|
$invoiceNumber = $this->getInvoiceNumber($invoiceNumber);
|
||||||
|
$invoiceNumber = strtolower($invoiceNumber);
|
||||||
|
return isset($this->maps['invoices'][$invoiceNumber]) ? $this->maps['invoices'][$invoiceNumber]->public_id : null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $invoiceNumber
|
* @param $invoiceNumber
|
||||||
*
|
*
|
||||||
|
@ -27,6 +27,7 @@ class PaymentTransformer extends BaseTransformer
|
|||||||
'payment_date_sql' => $this->getDate($data, 'payment_date'),
|
'payment_date_sql' => $this->getDate($data, 'payment_date'),
|
||||||
'client_id' => $this->getInvoiceClientId($data->invoice_num),
|
'client_id' => $this->getInvoiceClientId($data->invoice_num),
|
||||||
'invoice_id' => $this->getInvoiceId($data->invoice_num),
|
'invoice_id' => $this->getInvoiceId($data->invoice_num),
|
||||||
|
'invoice_public_id' => $this->getInvoicePublicId($data->invoice_num),
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -443,7 +443,9 @@ class ImportService
|
|||||||
// update the entity maps
|
// update the entity maps
|
||||||
if ($entityType != ENTITY_CUSTOMER) {
|
if ($entityType != ENTITY_CUSTOMER) {
|
||||||
$mapFunction = 'add' . ucwords($entity->getEntityType()) . 'ToMaps';
|
$mapFunction = 'add' . ucwords($entity->getEntityType()) . 'ToMaps';
|
||||||
$this->$mapFunction($entity);
|
if (method_exists($this, $mapFunction)) {
|
||||||
|
$this->$mapFunction($entity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the invoice is paid we'll also create a payment record
|
// if the invoice is paid we'll also create a payment record
|
||||||
@ -926,6 +928,7 @@ class ImportService
|
|||||||
private function addInvoiceToMaps(Invoice $invoice)
|
private function addInvoiceToMaps(Invoice $invoice)
|
||||||
{
|
{
|
||||||
if ($number = strtolower(trim($invoice->invoice_number))) {
|
if ($number = strtolower(trim($invoice->invoice_number))) {
|
||||||
|
$this->maps['invoices'][$number] = $invoice;
|
||||||
$this->maps['invoice'][$number] = $invoice->id;
|
$this->maps['invoice'][$number] = $invoice->id;
|
||||||
$this->maps['invoice_client'][$number] = $invoice->client_id;
|
$this->maps['invoice_client'][$number] = $invoice->client_id;
|
||||||
$this->maps['invoice_ids'][$invoice->public_id] = $invoice->id;
|
$this->maps['invoice_ids'][$invoice->public_id] = $invoice->id;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user