Back to basics.

This commit is contained in:
James Cole
2017-08-12 16:40:51 +02:00
parent accbff3ccb
commit a879528ed8
3 changed files with 456 additions and 450 deletions

View File

@@ -99,6 +99,7 @@ class CsvProcessor implements FileProcessorInterface
$this->job->addStepsDone(1);
}
);
return true;
}
@@ -215,6 +216,7 @@ class CsvProcessor implements FileProcessorInterface
throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError)));
}
$hash = hash('sha256', $json);
return $hash;
}
@@ -238,7 +240,7 @@ class CsvProcessor implements FileProcessorInterface
$journal->setHash($hash);
/**
* @var int $rowIndex
* @var int $rowIndex
* @var string $value
*/
foreach ($row as $rowIndex => $value) {
@@ -249,7 +251,8 @@ class CsvProcessor implements FileProcessorInterface
$journal->setValue($annotated);
}
}
Log::debug('ImportJournal complete, returning.');
// set some extra info:
$journal->asset->setDefaultAccountId($this->job->configuration['import-account']);
return $journal;
}
@@ -263,12 +266,12 @@ class CsvProcessor implements FileProcessorInterface
*/
private function rowAlreadyImported(array $array): bool
{
$hash = $this->getRowHash($array);
$json = json_encode($hash);
$entry = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
->where('data', $json)
->where('name', 'importHash')
->first();
$hash = $this->getRowHash($array);
$json = json_encode($hash);
$entry = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id')
->where('data', $json)
->where('name', 'importHash')
->first();
if (!is_null($entry)) {
return true;
}