1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Export contacts with client array (#3251)

This commit is contained in:
Benjamin Beganović 2020-01-27 21:54:54 +01:00 committed by David Bomba
parent 24daf955d8
commit e31ab11364

View File

@ -176,12 +176,46 @@ class StepsController extends BaseController
'shipping_state' => $client->shipping_state,
'shipping_postal_code' => $client->shipping_postal_code,
'shipping_country_id' => $client->shipping_country_id,
'contacts' => $this->getClientContacts($client->contacts),
];
}
return $clients;
}
/**
* @param $contacts
* @return array
*/
protected function getClientContacts($contacts)
{
$transformed = [];
foreach($contacts as $contact) {
$transformed[] = [
'id' => $contact->id,
'company_id' => $contact->account_id,
'user_id' => $contact->user_id,
'client_id' => $contact->client_id,
'first_name' => $contact->first_name,
'last_name' => $contact->last_name,
'phone' => $contact->phone,
'custom_value1' => $contact->custom_value1,
'custom_value2' => $contact->custom_value2,
'email' => $contact->email,
'is_primary' => $contact->is_primary,
'send_invoice' => $contact->send_invoice,
'confirmed' => $contact->confirmation_token ? true : false,
'last_login' => $contact->last_login,
'password' => $contact->password,
'remember_token' => $contact->remember_token,
'contact_key' => $contact->contact_key,
];
}
return $transformed;
}
/**
* @return array
*/