1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-18 09:04:35 +01:00
invoiceninja/app/Import/Transformers/InvoiceTransformer.php

62 lines
3.0 KiB
PHP
Raw Normal View History

<?php
/**
2021-02-18 00:51:56 +01:00
* Invoice Ninja (https://invoiceninja.com).
*
2021-02-18 00:51:56 +01:00
* @link https://github.com/invoiceninja/invoiceninja source repository
*
2021-02-18 00:51:56 +01:00
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Import\Transformers;
/**
* Class InvoiceTransformer.
*/
class InvoiceTransformer extends BaseTransformer
{
/**
* @param $data
*
* @return bool|Item
*/
public function transform($data)
{
return [
'company_id' => $this->maps['company']->id,
'number' => $this->getString($data, 'invoice.number'),
'user_id' => $this->getString($data, 'invoice.user_id'),
2020-12-19 08:28:58 +01:00
'amount' => $this->getFloat($data, 'invoice.amount'),
'balance' => $this->getFloat($data, 'invoice.balance'),
2020-12-20 08:02:58 +01:00
'client_id' => $this->getClient($this->getString($data, 'client.name'), $this->getString($data, 'client.email')),
2020-12-19 08:28:58 +01:00
'discount' => $this->getFloat($data, 'invoice.discount'),
'po_number' => $this->getString($data, 'invoice.po_number'),
'date' => $this->getString($data, 'invoice.date'),
'due_date' => $this->getString($data, 'invoice.due_date'),
'terms' => $this->getString($data, 'invoice.terms'),
'public_notes' => $this->getString($data, 'invoice.public_notes'),
'is_sent' => $this->getString($data, 'invoice.is_sent'),
'private_notes' => $this->getString($data, 'invoice.private_notes'),
'tax_name1' => $this->getString($data, 'invoice.tax_name1'),
2020-12-19 08:28:58 +01:00
'tax_rate1' => $this->getFloat($data, 'invoice.tax_rate1'),
'tax_name2' => $this->getString($data, 'invoice.tax_name2'),
2020-12-19 08:28:58 +01:00
'tax_rate2' => $this->getFloat($data, 'invoice.tax_rate2'),
'tax_name3' => $this->getString($data, 'invoice.tax_name3'),
2020-12-19 08:28:58 +01:00
'tax_rate3' => $this->getFloat($data, 'invoice.tax_rate3'),
'custom_value1' => $this->getString($data, 'invoice.custom_value1'),
'custom_value2' => $this->getString($data, 'invoice.custom_value2'),
'custom_value3' => $this->getString($data, 'invoice.custom_value3'),
'custom_value4' => $this->getString($data, 'invoice.custom_value4'),
'footer' => $this->getString($data, 'invoice.footer'),
2020-12-19 08:28:58 +01:00
'partial' => $this->getFloat($data, 'invoice.partial'),
'partial_due_date' => $this->getString($data, 'invoice.partial_due_date'),
'custom_surcharge1' => $this->getString($data, 'invoice.custom_surcharge1'),
'custom_surcharge2' => $this->getString($data, 'invoice.custom_surcharge2'),
'custom_surcharge3' => $this->getString($data, 'invoice.custom_surcharge3'),
'custom_surcharge4' => $this->getString($data, 'invoice.custom_surcharge4'),
'exchange_rate' => $this->getString($data, 'invoice.exchange_rate'),
];
}
2020-12-21 11:46:46 +01:00
}