mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 00:54:38 -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;
|
namespace App\Import\Transformer\Csv;
|
||||||
|
|
||||||
|
use App\DataMapper\ClientSettings;
|
||||||
use App\Import\ImportException;
|
use App\Import\ImportException;
|
||||||
use App\Import\Transformer\BaseTransformer;
|
use App\Import\Transformer\BaseTransformer;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@ -31,7 +32,7 @@ class ClientTransformer extends BaseTransformer
|
|||||||
throw new ImportException('Client already exists');
|
throw new ImportException('Client already exists');
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = new \stdClass();
|
$settings = ClientSettings::defaults();
|
||||||
$settings->currency_id = (string) $this->getCurrencyByCode($data);
|
$settings->currency_id = (string) $this->getCurrencyByCode($data);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -75,7 +75,15 @@ class ClientRepository extends BaseRepository
|
|||||||
$client->country_id = $company->settings->country_id;
|
$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) {
|
if (! isset($client->number) || empty($client->number) || strlen($client->number) == 0) {
|
||||||
// $client->number = $this->getNextClientNumber($client);
|
// $client->number = $this->getNextClientNumber($client);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user