1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 21:52:35 +01:00
invoiceninja/app/Ninja/Import/FreshBooks/VendorTransformer.php
steenrabol eed8ee55a1 Vendor
2016-01-07 16:21:13 +01:00

37 lines
1.2 KiB
PHP

<?php namespace App\Ninja\Import\FreshBooks;
use App\Ninja\Import\BaseTransformer;
use League\Fractal\Resource\Item;
// vendor
class VendorTransformer extends BaseTransformer
{
public function transform($data)
{
if ($this->hasVendor($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),
];
});
}
}