1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

fixes for client creation

This commit is contained in:
David Bomba 2019-10-02 17:52:38 +10:00
parent 98362e0347
commit f5d4ec951e

View File

@ -45,15 +45,20 @@ class ClientContactRepository extends BaseRepository
//loop and update/create contacts
$contacts->each(function ($contact) use ($client){
$update_contact = null;
$update_contact = ClientContact::firstOrNew(
['id' => $contact['id']],
[
'client_id' => $client->id,
'company_id' => $client->company_id,
'user_id' => auth()->user()->id
]
);
if(isset($contact['id']))
$update_contact = ClientContact::find($this->decodePrimaryKey($contact['id']));
if(!$update_contact){
$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);