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

Fixes for imports

This commit is contained in:
David Bomba 2022-02-10 13:55:44 +11:00
parent 95861a2a8c
commit cc4966845c
3 changed files with 8 additions and 17 deletions

View File

@ -148,16 +148,12 @@ class BaseImport
public function ingest($data, $entity_type)
{
$count = 0;
nlog("record count = ".count($data));
nlog($data);
foreach ($data as $key => $record) {
try {
nlog($key);
nlog($record);
$entity = $this->transformer->transform($record);
nlog($entity);
/** @var \App\Http\Requests\Request $request */
$request = new $this->request_name();
@ -178,20 +174,15 @@ nlog($entity);
$this->getUserIDForRecord($entity)
)
);
nlog("saving {$entity->name}");
$entity->saveQuietly();
$count++;
nlog("entity number");
nlog($entity->id);
nlog("after save");
}
} catch (\Exception $ex) {
nlog("exception");
nlog($ex->getMessage());
if ($ex instanceof ImportException) {
$message = $ex->getMessage();
@ -200,16 +191,15 @@ nlog($ex->getMessage());
$message = 'Unknown error';
}
nlog($message);
$this->error_array[$entity_type][] = [
$entity_type => $record,
'error' => $message,
];
}
return $count;
}
return $count;
}
public function ingestInvoices($invoices, $invoice_number_key)

View File

@ -188,7 +188,8 @@ class CsvImportTest extends TestCase
$base_transformer = new BaseTransformer($this->company);
$this->assertTrue($base_transformer->hasClient('Ludwig Krajcik DVM'));
$this->assertTrue($base_transformer->hasClient('Bradly Jaskolski Sr.'));
$client_id = $base_transformer->getClient('Ludwig Krajcik DVM', null);
$c = Client::find($client_id);

View File

@ -58,7 +58,7 @@ class WaveTest extends TestCase
2 => 'contact_first_name',
3 => 'contact_last_name',
4 => 'customer_currency',
// 5 => 'account_number',
5 => 'account_number',
6 => 'phone',
7 => 'fax',
8 => 'mobile',