mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-01-08 07:03:23 -06:00
42 lines
803 B
PHP
42 lines
803 B
PHP
<?php
|
|
|
|
namespace FireflyIII\Helpers\Csv\PostProcessing;
|
|
|
|
use FireflyIII\Models\TransactionCurrency;
|
|
use Preferences;
|
|
|
|
/**
|
|
* Class Currency
|
|
*
|
|
* @package FireflyIII\Helpers\Csv\PostProcessing
|
|
*/
|
|
class Currency implements PostProcessorInterface
|
|
{
|
|
|
|
/** @var array */
|
|
protected $data;
|
|
|
|
/**
|
|
* @return array
|
|
*/
|
|
public function process()
|
|
{
|
|
|
|
// fix currency
|
|
if (is_null($this->data['currency'])) {
|
|
$currencyPreference = Preferences::get('currencyPreference', 'EUR');
|
|
$this->data['currency'] = TransactionCurrency::whereCode($currencyPreference->data)->first();
|
|
}
|
|
|
|
return $this->data;
|
|
}
|
|
|
|
/**
|
|
* @param array $data
|
|
*/
|
|
public function setData(array $data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
}
|