Bunq and Spectre will ask to apply rules.

This commit is contained in:
James Cole
2018-06-23 10:55:26 +02:00
parent 19a874b274
commit a1d99c1954
8 changed files with 56 additions and 309 deletions

View File

@@ -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'));