From b9c3c74c16e98d260ffd39399b0f4a55843099c1 Mon Sep 17 00:00:00 2001 From: Frank Cools Date: Thu, 2 Oct 2025 22:10:16 +0200 Subject: [PATCH] Fix configuration loading for separate base and VAT mappings Fixed: - Base and VAT fields now load separate mappings - base_selected_accounts loads from line_BASE mappings - vat_selected_accounts loads from line_VAT mappings - Each field now shows its own saved values - No more duplicate values between base and VAT fields --- admin/setup_mvp.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/admin/setup_mvp.php b/admin/setup_mvp.php index 0588e1e..3b495e0 100644 --- a/admin/setup_mvp.php +++ b/admin/setup_mvp.php @@ -164,8 +164,6 @@ foreach ($lines_by_section as $section_code => $lines) { print ''; foreach ($lines as $line => $definition) { - $selected_accounts = isset($mappings_by_line[$line]) ? $mappings_by_line[$line] : array(); - print ''; print '' . $line . ''; print '' . $definition['label'] . ''; @@ -181,16 +179,21 @@ foreach ($lines_by_section as $section_code => $lines) { // Special handling for lines 08, 09, 9B (need both base and VAT accounts) if (in_array($line, array('08', '09', '9B'))) { + // Load separate mappings for base and VAT + $base_selected_accounts = isset($mappings_by_line[$line . '_BASE']) ? $mappings_by_line[$line . '_BASE'] : array(); + $vat_selected_accounts = isset($mappings_by_line[$line . '_VAT']) ? $mappings_by_line[$line . '_VAT'] : array(); + print '
'; print 'Comptes de base (ventes):
'; - print $form->multiselectarray('base_account_codes_' . $line, $account_options, $selected_accounts, 0, 0, '', 0, '200px'); + print $form->multiselectarray('base_account_codes_' . $line, $account_options, $base_selected_accounts, 0, 0, '', 0, '200px'); print '
'; print '
'; print 'Comptes de TVA:
'; - print $form->multiselectarray('vat_account_codes_' . $line, $account_options, $selected_accounts, 0, 0, '', 0, '200px'); + print $form->multiselectarray('vat_account_codes_' . $line, $account_options, $vat_selected_accounts, 0, 0, '', 0, '200px'); print '
'; } else { // Normal single selection for other lines + $selected_accounts = isset($mappings_by_line[$line]) ? $mappings_by_line[$line] : array(); print $form->multiselectarray('account_codes_' . $line, $account_options, $selected_accounts, 0, 0, '', 0, '200px'); } print '';