1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Merge pull request #4731 from turbo124/master

Fixes for contact imports
This commit is contained in:
David Bomba 2021-01-20 18:42:50 +11:00 committed by GitHub
commit d994994ac5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -232,7 +232,7 @@ trait GenerateMigrationResources
'shipping_state' => $client->shipping_state,
'shipping_postal_code' => $client->shipping_postal_code,
'shipping_country_id' => $client->shipping_country_id,
'contacts' => $this->getClientContacts($client->contacts()->withTrashed()),
'contacts' => $this->getClientContacts($client),
'settings' => $this->getClientSettings($client),
'created_at' => $client->created_at ? Carbon::parse($client->created_at)->toDateString() : null,
'updated_at' => $client->updated_at ? Carbon::parse($client->updated_at)->toDateString() : null,
@ -255,8 +255,10 @@ trait GenerateMigrationResources
return $settings;
}
protected function getClientContacts($contacts)
protected function getClientContacts($client)
{
$contacts = Contact::where('client_id', $client->id)->withTrashed()->get();
$transformed = [];
foreach ($contacts as $contact) {