Some better feedback in the import process.

This commit is contained in:
James Cole
2016-08-13 14:22:40 +02:00
parent c4d6aaeef3
commit ef876a165a
8 changed files with 73 additions and 15 deletions

View File

@@ -50,6 +50,7 @@ class ImportValidator
*/
public function clean(): Collection
{
Log::notice(sprintf('Started validating %d entry(ies).', $this->entries->count()));
$newCollection = new Collection;
/** @var ImportEntry $entry */
foreach ($this->entries as $index => $entry) {
@@ -71,6 +72,7 @@ class ImportValidator
$newCollection->put($index, $entry);
}
Log::notice(sprintf('Finished validating %d entry(ies).', $newCollection->count()));
return $newCollection;
}
@@ -100,7 +102,7 @@ class ImportValidator
{
if ($entry->fields['amount'] == 0) {
$entry->valid = false;
Log::error('Amount of transaction is zero, cannot handle.');
Log::warning('Amount of transaction is zero, cannot handle.');
return $entry;
}
@@ -229,7 +231,7 @@ class ImportValidator
// default import is null? should not happen. Entry cannot be imported.
// set error message and block.
$entry->valid = false;
Log::error('Cannot import entry. Asset account is NULL and import account is also NULL.');
Log::warning('Cannot import entry. Asset account is NULL and import account is also NULL.');
}
Log::debug('Asset account is OK.', ['id' => $entry->fields['asset-account']->id, 'name' => $entry->fields['asset-account']->name]);
@@ -379,7 +381,7 @@ class ImportValidator
return $entry;
}
Log::error(sprintf('Opposing account is of type %s, cannot handle this.', $type));
Log::warning(sprintf('Opposing account is of type %s, cannot handle this.', $type));
$entry->valid = false;
return $entry;