mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-19 02:52:44 +00:00
Can now create jobs, and set prerequisites for the fake provider, which will be skipped when they're not necessary.
This commit is contained in:
@@ -74,8 +74,23 @@ class IndexController extends Controller
|
||||
{
|
||||
$importJob = $this->repository->create($importProvider);
|
||||
|
||||
// redirect to global prerequisites
|
||||
return redirect(route('import.prerequisites.index', [$importProvider, $importJob->key]));
|
||||
// if need to set prerequisites, do that first.
|
||||
$class = (string)config(sprintf('import.prerequisites.%s', $importProvider));
|
||||
if (!class_exists($class)) {
|
||||
throw new FireflyException(sprintf('No class to handle configuration for "%s".', $importProvider)); // @codeCoverageIgnore
|
||||
}
|
||||
/** @var PrerequisitesInterface $object */
|
||||
$object = app($class);
|
||||
$object->setUser(auth()->user());
|
||||
|
||||
if (!$object->isComplete()) {
|
||||
// redirect to global prerequisites
|
||||
return redirect(route('import.prerequisites.index', [$importProvider, $importJob->key]));
|
||||
}
|
||||
|
||||
// Otherwise just redirect to job configuration.
|
||||
return redirect(route('import.job.configuration.index', [$importJob->key]));
|
||||
|
||||
}
|
||||
|
||||
// /**
|
||||
|
Reference in New Issue
Block a user