1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00
invoiceninja/app/Ninja/Import/FreshBooks/ClientTransformer.php
2015-12-08 12:10:20 +02:00

37 lines
1.2 KiB
PHP

<?php namespace App\Ninja\Import\FreshBooks;
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
class ClientTransformer extends BaseTransformer
{
public function transform($data)
{
if ($this->hasClient($data->organization)) {
return false;
}
return new Item($data, function ($data) {
return [
'name' => $data->organization,
'work_phone' => $data->busphone,
'address1' => $data->street,
'address2' => $data->street2,
'city' => $data->city,
'state' => $data->province,
'postal_code' => $data->postalcode,
'private_notes' => $data->notes,
'contacts' => [
[
'first_name' => $data->firstname,
'last_name' => $data->lastname,
'email' => $data->email,
'phone' => $data->mobphone ?: $data->homephone,
],
],
'country_id' => $this->getCountryId($data->country),
];
});
}
}