diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.php index 78057ac42c..e3ff9dbc60 100644 --- a/app/Console/Commands/Import.php +++ b/app/Console/Commands/Import.php @@ -22,8 +22,10 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Import\Logging\CommandHandler; use FireflyIII\Import\Routine\ImportRoutine; +use FireflyIII\Import\Routine\RoutineInterface; use FireflyIII\Models\ImportJob; use Illuminate\Console\Command; use Illuminate\Support\MessageBag; @@ -81,8 +83,16 @@ class Import extends Command $handler = new CommandHandler($this); $monolog->pushHandler($handler); - /** @var ImportRoutine $routine */ - $routine = app(ImportRoutine::class); + // actually start job: + $type = $job->file_type === 'csv' ? 'file' : $job->file_type; + $key = sprintf('import.routine.%s', $type); + $className = config($key); + if (null === $className || !class_exists($className)) { + throw new FireflyException(sprintf('Cannot find import routine class for job of type "%s".', $type)); // @codeCoverageIgnore + } + + /** @var RoutineInterface $routine */ + $routine = app($className); $routine->setJob($job); $routine->run(); diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index c573d747a2..b7f8e3ca89 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -245,6 +245,10 @@ class ImportJournal $this->notes .= ' ' . $array['value']; $this->notes = trim($this->notes); break; + case 'note': + $this->notes .= ' ' . $array['value']; + $this->notes = trim($this->notes); + break; case 'external-id': $this->externalId = $array['value']; break; diff --git a/config/csv.php b/config/csv.php index 0677cc1f8b..adf39792c3 100644 --- a/config/csv.php +++ b/config/csv.php @@ -89,6 +89,12 @@ return [ 'converter' => 'BillId', 'mapper' => 'Bills', ], + 'note' => [ + 'mappable' => false, + 'pre-process-map' => false, + 'field' => 'note', + 'converter' => 'Note', + ], 'bill-name' => [ 'mappable' => true, 'pre-process-map' => false, diff --git a/resources/lang/en_US/import.php b/resources/lang/en_US/import.php index 61c4516fac..aeb2e41c55 100644 --- a/resources/lang/en_US/import.php +++ b/resources/lang/en_US/import.php @@ -138,6 +138,7 @@ return [ 'column_tags-space' => 'Tags (space separated)', 'column_account-number' => 'Asset account (account number)', 'column_opposing-number' => 'Opposing account (account number)', + 'column_note' => 'Note(s)', // bunq 'bunq_prerequisites_title' => 'Prerequisites for an import from bunq',