mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-31 21:04:35 -04:00
fixes for client creation
This commit is contained in:
parent
98362e0347
commit
f5d4ec951e
@ -45,15 +45,20 @@ class ClientContactRepository extends BaseRepository
|
|||||||
|
|
||||||
//loop and update/create contacts
|
//loop and update/create contacts
|
||||||
$contacts->each(function ($contact) use ($client){
|
$contacts->each(function ($contact) use ($client){
|
||||||
|
|
||||||
|
$update_contact = null;
|
||||||
|
|
||||||
$update_contact = ClientContact::firstOrNew(
|
if(isset($contact['id']))
|
||||||
['id' => $contact['id']],
|
$update_contact = ClientContact::find($this->decodePrimaryKey($contact['id']));
|
||||||
[
|
|
||||||
'client_id' => $client->id,
|
if(!$update_contact){
|
||||||
'company_id' => $client->company_id,
|
|
||||||
'user_id' => auth()->user()->id
|
$update_contact = new ClientContact;
|
||||||
]
|
$update_contact->client_id = $client->id;
|
||||||
);
|
$update_contact->company_id = $client->company_id;
|
||||||
|
$update_contact->user_id = $client->user_id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$update_contact->fill($contact);
|
$update_contact->fill($contact);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user