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:
parent
95861a2a8c
commit
cc4966845c
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user