Lots of new code to test the import routine.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
This commit is contained in:
James Cole
2016-08-11 10:21:32 +02:00
parent efe9933721
commit 186b704509
27 changed files with 1315 additions and 67 deletions

View File

@@ -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.
}
}