Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix #893
James Cole35a531048561
diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.phpindex dabe765386..e5b9f1fec8 100644--- a/app/Import/Storage/ImportStorage.php+++ b/app/Import/Storage/ImportStorage.php@@ -212,38 +212,48 @@ class ImportStorage*/private function isDoubleTransfer(array $parameters): bool{+ Log::debug('Check if is a double transfer.');if ($parameters['type'] !== TransactionType::TRANSFER) {+ Log::debug(sprintf('Is a %s, not a transfer so no.' . $parameters['type']));+return false;}$amount = app('steam')->positive($parameters['amount']);$names = [$parameters['asset'], $parameters['opposing']];$transfer = [];- $hits = 0;+sort($names);foreach ($this->transfers as $transfer) {+ $hits = 0;if ($parameters['description'] === $transfer['description']) {$hits++;+ Log::debug(sprintf('Description "%s" equals "%s", hits = %d', $parameters['description'], $transfer['description'], $hits));}if ($names === $transfer['names']) {$hits++;+ Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', join(',', $names), join(',', $transfer['names']), $hits));}if (bccomp($amount, $transfer['amount']) === 0) {$hits++;+ Log::debug(sprintf('Amount %s equals %s, hits = %d', $amount, $transfer['amount'], $hits));}if ($parameters['date'] === $transfer['date']) {$hits++;+ Log::debug(sprintf('Date %s equals %s, hits = %d', $parameters['date'], $transfer['date'], $hits));}- }- if ($hits === 4) {- Log::error(- 'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters]- );+ // number of hits is 4? Then it's a match+ if ($hits === 4) {+ Log::error(+ 'There already is a transfer imported with these properties. Compare existing with new. ', ['existing' => $transfer, 'new' => $parameters]+ );- return true;+ return true;+ }}+return false;}}