mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Adjustments for vendor imports
This commit is contained in:
parent
b8c4d6668f
commit
843d7c3bf4
@ -477,8 +477,12 @@ class BaseImport
|
||||
}
|
||||
|
||||
nlog($invoice_data);
|
||||
$saveable_invoice_data = $invoice_data;
|
||||
|
||||
if(array_key_exists('payments', $saveable_invoice_data))
|
||||
unset($saveable_invoice_data['payments']);
|
||||
|
||||
$invoice_repository->save($invoice_data, $invoice);
|
||||
$invoice_repository->save($saveable_invoice_data, $invoice);
|
||||
|
||||
$count++;
|
||||
// If we're doing a generic CSV import, only import payment data if we're not importing a payment CSV.
|
||||
@ -504,7 +508,7 @@ class BaseImport
|
||||
];
|
||||
|
||||
/* Make sure we don't apply any payments to invoices with a Zero Amount*/
|
||||
if ($invoice->amount > 0) {
|
||||
if ($invoice->amount > 0 && $payment_data['amount'] > 0) {
|
||||
|
||||
$payment = $payment_repository->save(
|
||||
$payment_data,
|
||||
|
@ -43,10 +43,14 @@ class VendorRepository extends BaseRepository
|
||||
*/
|
||||
public function save(array $data, Vendor $vendor) : ?Vendor
|
||||
{
|
||||
$vendor->fill($data);
|
||||
|
||||
nlog($data);
|
||||
|
||||
$saveable_vendor = $data;
|
||||
|
||||
if(array_key_exists('contacts', $data)) {
|
||||
unset($saveable_vendor['contacts']);
|
||||
}
|
||||
|
||||
$vendor->fill($saveable_vendor);
|
||||
|
||||
$vendor->saveQuietly();
|
||||
|
||||
if ($vendor->number == '' || ! $vendor->number) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user