mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Improve handling of saving a client that has been created from an invoice import
This commit is contained in:
parent
e43d638d10
commit
47916ed30a
@ -11,6 +11,7 @@
|
||||
|
||||
namespace App\Import\Transformer\Csv;
|
||||
|
||||
use App\DataMapper\ClientSettings;
|
||||
use App\Import\ImportException;
|
||||
use App\Import\Transformer\BaseTransformer;
|
||||
use Illuminate\Support\Str;
|
||||
@ -31,7 +32,7 @@ class ClientTransformer extends BaseTransformer
|
||||
throw new ImportException('Client already exists');
|
||||
}
|
||||
|
||||
$settings = new \stdClass();
|
||||
$settings = ClientSettings::defaults();
|
||||
$settings->currency_id = (string) $this->getCurrencyByCode($data);
|
||||
|
||||
return [
|
||||
|
@ -75,7 +75,15 @@ class ClientRepository extends BaseRepository
|
||||
$client->country_id = $company->settings->country_id;
|
||||
}
|
||||
|
||||
$client->save();
|
||||
try{
|
||||
$client->save();
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
|
||||
nlog("client save failed");
|
||||
nlog($data);
|
||||
|
||||
}
|
||||
|
||||
if (! isset($client->number) || empty($client->number) || strlen($client->number) == 0) {
|
||||
// $client->number = $this->getNextClientNumber($client);
|
||||
|
Loading…
x
Reference in New Issue
Block a user