mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-25 21:16:47 +00:00
Bunq and Spectre will ask to apply rules.
This commit is contained in:
@@ -76,10 +76,11 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
|
||||
*/
|
||||
public function configureJob(array $data): MessageBag
|
||||
{
|
||||
$config = $this->repository->getConfiguration($this->importJob);
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
$mapping = $data['account_mapping'] ?? [];
|
||||
$final = [];
|
||||
$config = $this->repository->getConfiguration($this->importJob);
|
||||
$accounts = $config['accounts'] ?? [];
|
||||
$mapping = $data['account_mapping'] ?? [];
|
||||
$applyRules = (int)$data['apply_rules'] === 1;
|
||||
$final = [];
|
||||
if (\count($accounts) === 0) {
|
||||
throw new FireflyException('No bunq accounts found. Import cannot continue.'); // @codeCoverageIgnore
|
||||
}
|
||||
@@ -98,7 +99,8 @@ class ChooseAccountsHandler implements BunqJobConfigurationInterface
|
||||
$accountId = $this->validLocalAccount($localId);
|
||||
$final[$bunqId] = $accountId;
|
||||
}
|
||||
$config['mapping'] = $final;
|
||||
$config['mapping'] = $final;
|
||||
$config['apply-rules'] = $applyRules;
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
|
||||
return new MessageBag;
|
||||
|
||||
@@ -45,11 +45,6 @@ class NewBunqJobHandler implements BunqJobConfigurationInterface
|
||||
*/
|
||||
public function configurationComplete(): bool
|
||||
{
|
||||
// simply set the job configuration "apply-rules" to true.
|
||||
$config = $this->repository->getConfiguration($this->importJob);
|
||||
$config['apply-rules'] = true;
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,9 +83,10 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
public function configureJob(array $data): MessageBag
|
||||
{
|
||||
Log::debug('Now in ChooseAccountsHandler::configureJob()', $data);
|
||||
$config = $this->importJob->configuration;
|
||||
$mapping = $data['account_mapping'] ?? [];
|
||||
$final = [];
|
||||
$config = $this->importJob->configuration;
|
||||
$mapping = $data['account_mapping'] ?? [];
|
||||
$final = [];
|
||||
$applyRules = (int)$data['apply_rules'] === 1;
|
||||
foreach ($mapping as $spectreId => $localId) {
|
||||
// validate each
|
||||
$spectreId = $this->validSpectreAccount((int)$spectreId);
|
||||
@@ -96,7 +97,7 @@ class ChooseAccountsHandler implements SpectreJobConfigurationInterface
|
||||
Log::debug('Final mapping is:', $final);
|
||||
$messages = new MessageBag;
|
||||
$config['account_mapping'] = $final;
|
||||
|
||||
$config['apply-rules'] = $applyRules;
|
||||
$this->repository->setConfiguration($this->importJob, $config);
|
||||
if ($final === [0 => 0] || \count($final) === 0) {
|
||||
$messages->add('count', trans('import.spectre_no_mapping'));
|
||||
|
||||
Reference in New Issue
Block a user