mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
refactor to include client object/ id
This commit is contained in:
parent
b1d2f85af3
commit
7520b6318d
@ -119,10 +119,13 @@ class InvoiceTransformer extends BaseTransformer
|
|||||||
$customer = explode(" ", $this->getString($data, 'CustomerRef.name'));
|
$customer = explode(" ", $this->getString($data, 'CustomerRef.name'));
|
||||||
$customer = ['GivenName' => $customer[0], 'FamilyName' => $customer[1]];
|
$customer = ['GivenName' => $customer[0], 'FamilyName' => $customer[1]];
|
||||||
$has_company = property_exists($bill_address, 'Line4');
|
$has_company = property_exists($bill_address, 'Line4');
|
||||||
|
$address = $has_company? $bill_address->Line4 : $bill_address->Line3;
|
||||||
|
$address_1 = substr($address, 0, stripos($address,','));
|
||||||
|
$address =array_filter( [$address_1] + (explode(' ', substr($address, stripos($address,",") + 1 ))));
|
||||||
$client =
|
$client =
|
||||||
[
|
[
|
||||||
"CompanyName" => $has_company? $bill_address->Line2 : $bill_address->Line1,
|
"CompanyName" => $has_company? $bill_address->Line2 : $bill_address->Line1,
|
||||||
"BillAddr" => array_combine(['City','CountrySubDivisionCode','PostalCode'], array_filter(explode(" ", $has_company? $bill_address->Line4 : $bill_address->Line3 ))) + ['Line1' => $has_company? $bill_address->Line3 : $bill_address->Line2 ],
|
"BillAddr" => array_combine(['City','CountrySubDivisionCode','PostalCode'], $address) + ['Line1' => $has_company? $bill_address->Line3 : $bill_address->Line2 ],
|
||||||
"ShipAddr" => $ship_address
|
"ShipAddr" => $ship_address
|
||||||
] + $customer + ['PrimaryEmailAddr' => ['Address' => $this->getString($data, 'BillEmail.Address') ]];
|
] + $customer + ['PrimaryEmailAddr' => ['Address' => $this->getString($data, 'BillEmail.Address') ]];
|
||||||
$client_id = $this->getClient($client['CompanyName'],$this->getString($client, 'PrimaryEmailAddr.Address'));
|
$client_id = $this->getClient($client['CompanyName'],$this->getString($client, 'PrimaryEmailAddr.Address'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user