mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for zoho imports
This commit is contained in:
parent
f45d7f2897
commit
0c5c4c1188
@ -65,6 +65,7 @@ class BaseTransformer
|
||||
|
||||
public function getClient($client_name, $client_email)
|
||||
{
|
||||
|
||||
if (! empty($client_name)) {
|
||||
$client_id_search = $this->company
|
||||
->clients()
|
||||
|
@ -38,13 +38,15 @@ class ClientTransformer extends BaseTransformer
|
||||
$settings->payment_terms = $data['Payment Terms'];
|
||||
}
|
||||
|
||||
$client_id_proxy = array_key_exists('Customer ID', $data) ? 'Customer ID' : 'Primary Contact ID';
|
||||
|
||||
return [
|
||||
'company_id' => $this->company->id,
|
||||
'name' => $this->getString($data, 'Company Name'),
|
||||
'name' => $this->getString($data, 'Display Name'),
|
||||
'phone' => $this->getString($data, 'Phone'),
|
||||
'private_notes' => $this->getString($data, 'Notes'),
|
||||
'website' => $this->getString($data, 'Website'),
|
||||
'id_number' => $this->getString($data, 'Customer ID'),
|
||||
'id_number' => $this->getString($data, $client_id_proxy),
|
||||
'address1' => $this->getString($data, 'Billing Address'),
|
||||
'address2' => $this->getString($data, 'Billing Street2'),
|
||||
'city' => $this->getString($data, 'Billing City'),
|
||||
|
@ -40,7 +40,7 @@ class InvoiceTransformer extends BaseTransformer
|
||||
|
||||
$transformed = [
|
||||
'company_id' => $this->company->id,
|
||||
'client_id' => $this->getClient($this->getString($invoice_data, 'Customer ID'), null),
|
||||
'client_id' => $this->getClient($this->getString($invoice_data, 'Customer ID'), $this->getString($invoice_data, 'Primary Contact EmailID')),
|
||||
'number' => $this->getString($invoice_data, 'Invoice Number'),
|
||||
'date' => isset($invoice_data['Invoice Date']) ? date('Y-m-d', strtotime($invoice_data['Invoice Date'])) : null,
|
||||
'due_date' => isset($invoice_data['Due Date']) ? date('Y-m-d', strtotime($invoice_data['Due Date'])) : null,
|
||||
|
Loading…
x
Reference in New Issue
Block a user