mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New code for double transfer routine. #797
This commit is contained in:
parent
a942313f85
commit
068b9e388f
@ -210,24 +210,29 @@ class ImportStorage
|
||||
$amount = app('steam')->positive($parameters['amount']);
|
||||
$names = [$parameters['asset'], $parameters['opposing']];
|
||||
$transfer = [];
|
||||
$hit = false;
|
||||
sort($names);
|
||||
|
||||
foreach ($this->transfers as $transfer) {
|
||||
if ($parameters['description'] !== $transfer['description']) {
|
||||
return false;
|
||||
if ($parameters['description'] === $transfer['description']) {
|
||||
$hit = true;
|
||||
}
|
||||
if ($names !== $transfer['names']) {
|
||||
return false;
|
||||
if ($names === $transfer['names']) {
|
||||
$hit = true;
|
||||
}
|
||||
if (bccomp($amount, $transfer['amount']) !== 0) {
|
||||
return false;
|
||||
if (bccomp($amount, $transfer['amount']) === 0) {
|
||||
$hit = true;
|
||||
}
|
||||
if ($parameters['date'] !== $transfer['date']) {
|
||||
return false;
|
||||
if ($parameters['date'] === $transfer['date']) {
|
||||
$hit = true;
|
||||
}
|
||||
}
|
||||
Log::error('There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters]);
|
||||
if ($hit === true) {
|
||||
Log::error(
|
||||
'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters]
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
return $hit;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user