mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-10 12:24:50 +00:00
Lots of new code to test the import routine.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
@@ -58,6 +58,7 @@ class ImportStorage
|
||||
public function store()
|
||||
{
|
||||
foreach ($this->entries as $entry) {
|
||||
Log::debug('--- import store start ---');
|
||||
$this->storeSingle($entry);
|
||||
}
|
||||
|
||||
@@ -80,9 +81,17 @@ class ImportStorage
|
||||
|
||||
/**
|
||||
* @param ImportEntry $entry
|
||||
*
|
||||
* @throws FireflyException
|
||||
*/
|
||||
private function storeSingle(ImportEntry $entry)
|
||||
{
|
||||
if ($entry->valid === false) {
|
||||
Log::error('Cannot import entry, because valid=false');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Log::debug('Going to store entry!');
|
||||
$billId = is_null($entry->fields['bill']) ? null : $entry->fields['bill']->id;
|
||||
$journalData = [
|
||||
@@ -145,7 +154,8 @@ class ImportStorage
|
||||
|
||||
$one = Transaction::create($sourceData);
|
||||
$two = Transaction::create($destinationData);
|
||||
Log::debug('Created transactions', ['source' => $one->id,'destination' => $two->id]);
|
||||
Log::debug('Created transaction 1', ['id' => $one->id, 'account' => $one->account_id,'account_name' => $source->name]);
|
||||
Log::debug('Created transaction 2', ['id' => $two->id, 'account' => $two->account_id,'account_name' => $destination->name]);
|
||||
|
||||
$journal->completed = 1;
|
||||
$journal->save();
|
||||
@@ -153,6 +163,5 @@ class ImportStorage
|
||||
// now attach budget and so on.
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user