Browse Source

Partial fix for #10550

pull/867/head
James Cole 3 months ago
parent
commit
881b28985e
  1. 13
      app/Http/Controllers/Import/ConfigurationController.php
  2. 3
      resources/views/v2/components/firefly-iii-account-generic.blade.php

13
app/Http/Controllers/Import/ConfigurationController.php

@ -318,23 +318,26 @@ class ConfigurationController extends Controller
// TODO are all fields actually in the config?
// loop accounts:
$accounts = [];
$allNewAccounts = $fromRequest['new_account'] ?? [];
$toCreateNewAccounts = [];
foreach (array_keys($fromRequest['do_import']) as $identifier) {
if (array_key_exists($identifier, $fromRequest['accounts'])) {
$accountValue = (int)$fromRequest['accounts'][$identifier];
$accounts[$identifier] = $accountValue;
}
if (array_key_exists($identifier, $allNewAccounts)) {
// this is a new account to create.
$toCreateNewAccounts[$identifier] = $allNewAccounts[$identifier];
}
if (!array_key_exists($identifier, $fromRequest['accounts'])) {
Log::warning(sprintf('Account identifier %s in do_import but not in accounts array', $identifier));
}
}
$configuration->setAccounts($accounts);
// Store new account creation data
$newAccounts = $fromRequest['new_account'] ?? [];
$configuration->setNewAccounts($newAccounts);
$configuration->setNewAccounts($toCreateNewAccounts);
// Store do_import selections in session for validation
session()->put('do_import', $fromRequest['do_import'] ?? []);

3
resources/views/v2/components/firefly-iii-account-generic.blade.php

@ -69,9 +69,12 @@
name="new_account[{{ str_replace(' ', '_', $account['import_account']->id) }}][create]"
value="0">
<!-- #10550 do not set do_import to true for ALL accounts. -->
<!--
<input type="hidden"
name="do_import[{{ str_replace(' ', '_', $account['import_account']->id) }}]"
value="1">
-->
<script>
function handleAccountSelection(accountId, selectedValue) {

Loading…
Cancel
Save