mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 18:54:58 +00:00 
			
		
		
		
	Fix for #825
This commit is contained in:
		| @@ -35,16 +35,15 @@ class ImportStorage | |||||||
|     /** @var Collection */ |     /** @var Collection */ | ||||||
|     public $journals; |     public $journals; | ||||||
|     /** @var  int */ |     /** @var  int */ | ||||||
|     protected $defaultCurrencyId = 1; |     protected $defaultCurrencyId = 1; // yes, hard coded | ||||||
|     /** @var string */ |  | ||||||
|     private $dateFormat = 'Ymd'; // yes, hard coded |  | ||||||
|     /** @var  ImportJob */ |     /** @var  ImportJob */ | ||||||
|     protected $job; |     protected $job; | ||||||
|     /** @var Collection */ |     /** @var Collection */ | ||||||
|     private $objects; |  | ||||||
|     /** @var Collection */ |  | ||||||
|     protected $rules; |     protected $rules; | ||||||
|  |     /** @var string */ | ||||||
|  |     private $dateFormat = 'Ymd'; | ||||||
|  |     /** @var Collection */ | ||||||
|  |     private $objects; | ||||||
|     /** @var  array */ |     /** @var  array */ | ||||||
|     private $transfers = []; |     private $transfers = []; | ||||||
|  |  | ||||||
| @@ -214,29 +213,31 @@ class ImportStorage | |||||||
|         $amount   = app('steam')->positive($parameters['amount']); |         $amount   = app('steam')->positive($parameters['amount']); | ||||||
|         $names    = [$parameters['asset'], $parameters['opposing']]; |         $names    = [$parameters['asset'], $parameters['opposing']]; | ||||||
|         $transfer = []; |         $transfer = []; | ||||||
|         $hit      = false; |         $hits     = 0; | ||||||
|         sort($names); |         sort($names); | ||||||
|  |  | ||||||
|         foreach ($this->transfers as $transfer) { |         foreach ($this->transfers as $transfer) { | ||||||
|             if ($parameters['description'] === $transfer['description']) { |             if ($parameters['description'] === $transfer['description']) { | ||||||
|                 $hit = true; |                 $hits++; | ||||||
|             } |             } | ||||||
|             if ($names === $transfer['names']) { |             if ($names === $transfer['names']) { | ||||||
|                 $hit = true; |                 $hits++; | ||||||
|             } |             } | ||||||
|             if (bccomp($amount, $transfer['amount']) === 0) { |             if (bccomp($amount, $transfer['amount']) === 0) { | ||||||
|                 $hit = true; |                 $hits++; | ||||||
|             } |             } | ||||||
|             if ($parameters['date'] === $transfer['date']) { |             if ($parameters['date'] === $transfer['date']) { | ||||||
|                 $hit = true; |                 $hits++; | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if ($hit === true) { |         if ($hits === 4) { | ||||||
|             Log::error( |             Log::error( | ||||||
|                 'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters] |                 'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters] | ||||||
|             ); |             ); | ||||||
|  |  | ||||||
|  |             return true; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         return $hit; |         return false; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user