mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Extend ImportObject with row hash.
This commit is contained in:
parent
e440d55034
commit
117bb602dc
@ -32,6 +32,8 @@ class ImportEntry
|
|||||||
public $externalID;
|
public $externalID;
|
||||||
/** @var array */
|
/** @var array */
|
||||||
public $fields = [];
|
public $fields = [];
|
||||||
|
/** @var string */
|
||||||
|
public $hash;
|
||||||
/** @var User */
|
/** @var User */
|
||||||
public $user;
|
public $user;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
@ -77,6 +79,10 @@ class ImportEntry
|
|||||||
default:
|
default:
|
||||||
Log::error('Import entry cannot handle object.', ['role' => $role]);
|
Log::error('Import entry cannot handle object.', ['role' => $role]);
|
||||||
throw new FireflyException('Import entry cannot handle object of type "' . $role . '".');
|
throw new FireflyException('Import entry cannot handle object of type "' . $role . '".');
|
||||||
|
case 'hash':
|
||||||
|
$this->hash = $convertedValue;
|
||||||
|
|
||||||
|
return;
|
||||||
case 'amount':
|
case 'amount':
|
||||||
/*
|
/*
|
||||||
* Easy enough.
|
* Easy enough.
|
||||||
|
@ -100,6 +100,10 @@ class CsvImporter implements ImporterInterface
|
|||||||
$object->setUser($this->job->user);
|
$object->setUser($this->job->user);
|
||||||
$config = $this->job->configuration;
|
$config = $this->job->configuration;
|
||||||
|
|
||||||
|
// hash the row:
|
||||||
|
$hash = hash('sha256', json_encode($row));
|
||||||
|
$object->importValue('hash', 100, $hash);
|
||||||
|
|
||||||
// and this is the point where the specifix go to work.
|
// and this is the point where the specifix go to work.
|
||||||
foreach ($config['specifics'] as $name => $enabled) {
|
foreach ($config['specifics'] as $name => $enabled) {
|
||||||
/** @var SpecificInterface $specific */
|
/** @var SpecificInterface $specific */
|
||||||
|
Loading…
Reference in New Issue
Block a user