mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	New converters for #180 (Currency)
This commit is contained in:
		| @@ -3,6 +3,7 @@ declare(strict_types = 1); | ||||
| namespace FireflyIII\Helpers\Csv\Converter; | ||||
|  | ||||
| use FireflyIII\Models\TransactionCurrency; | ||||
| use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; | ||||
|  | ||||
| /** | ||||
|  * Class CurrencyCode | ||||
| @@ -17,10 +18,14 @@ class CurrencyCode extends BasicConverter implements ConverterInterface | ||||
|      */ | ||||
|     public function convert() | ||||
|     { | ||||
|         /** @var CurrencyRepositoryInterface $repository */ | ||||
|         $repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface'); | ||||
|  | ||||
|  | ||||
|         if (isset($this->mapped[$this->index][$this->value])) { | ||||
|             $currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]); | ||||
|             $currency = $repository->find($this->mapped[$this->index][$this->value]); | ||||
|         } else { | ||||
|             $currency = TransactionCurrency::whereCode($this->value)->first(); | ||||
|             $currency = $repository->findByCode($this->value); | ||||
|         } | ||||
|  | ||||
|         return $currency; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user