mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-13 06:32:40 +01:00
19080933b6
Shift automatically applies the Laravel coding style - which uses the PSR-2 coding style as a base with some minor additions. You may customize the code style applied by adding a [PHP CS Fixer][1] or [PHP CodeSniffer][2] ruleset to your project root. Feel free to use [Shift's Laravel ruleset][3] to help you get started. For more information on customizing the code style applied by Shift, [watch this short video][4]. [1]: https://github.com/FriendsOfPHP/PHP-CS-Fixer [2]: https://github.com/squizlabs/PHP_CodeSniffer [3]: https://gist.github.com/laravel-shift/cab527923ed2a109dda047b97d53c200 [4]: https://laravelshift.com/videos/shift-code-style
62 lines
2.9 KiB
PHP
62 lines
2.9 KiB
PHP
<?php
|
|
/**
|
|
* Invoice Ninja (https://invoiceninja.com).
|
|
*
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
*
|
|
* @copyright Copyright (c) 2022. Invoice Ninja LLC (https://invoiceninja.com)
|
|
*
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
|
*/
|
|
|
|
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'),
|
|
'amount' => $this->getFloat($data, 'invoice.amount'),
|
|
'balance' => $this->getFloat($data, 'invoice.balance'),
|
|
'client_id' => $this->getClient($this->getString($data, 'client.name'), $this->getString($data, 'client.email')),
|
|
'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'),
|
|
'tax_rate1' => $this->getFloat($data, 'invoice.tax_rate1'),
|
|
'tax_name2' => $this->getString($data, 'invoice.tax_name2'),
|
|
'tax_rate2' => $this->getFloat($data, 'invoice.tax_rate2'),
|
|
'tax_name3' => $this->getString($data, 'invoice.tax_name3'),
|
|
'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'),
|
|
'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'),
|
|
];
|
|
}
|
|
}
|