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']);
|
$amount = app('steam')->positive($parameters['amount']);
|
||||||
$names = [$parameters['asset'], $parameters['opposing']];
|
$names = [$parameters['asset'], $parameters['opposing']];
|
||||||
$transfer = [];
|
$transfer = [];
|
||||||
|
$hit = false;
|
||||||
sort($names);
|
sort($names);
|
||||||
|
|
||||||
foreach ($this->transfers as $transfer) {
|
foreach ($this->transfers as $transfer) {
|
||||||
if ($parameters['description'] !== $transfer['description']) {
|
if ($parameters['description'] === $transfer['description']) {
|
||||||
return false;
|
$hit = true;
|
||||||
}
|
}
|
||||||
if ($names !== $transfer['names']) {
|
if ($names === $transfer['names']) {
|
||||||
return false;
|
$hit = true;
|
||||||
}
|
}
|
||||||
if (bccomp($amount, $transfer['amount']) !== 0) {
|
if (bccomp($amount, $transfer['amount']) === 0) {
|
||||||
return false;
|
$hit = true;
|
||||||
}
|
}
|
||||||
if ($parameters['date'] !== $transfer['date']) {
|
if ($parameters['date'] === $transfer['date']) {
|
||||||
return false;
|
$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