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
This commit is contained in:
parent
8f01229c1a
commit
b9c3c74c16
@ -164,8 +164,6 @@ foreach ($lines_by_section as $section_code => $lines) {
|
||||
print '</tr>';
|
||||
|
||||
foreach ($lines as $line => $definition) {
|
||||
$selected_accounts = isset($mappings_by_line[$line]) ? $mappings_by_line[$line] : array();
|
||||
|
||||
print '<tr>';
|
||||
print '<td><strong>' . $line . '</strong></td>';
|
||||
print '<td>' . $definition['label'] . '</td>';
|
||||
@ -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 '<div style="margin-bottom: 10px;">';
|
||||
print '<strong>Comptes de base (ventes):</strong><br>';
|
||||
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 '</div>';
|
||||
print '<div>';
|
||||
print '<strong>Comptes de TVA:</strong><br>';
|
||||
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 '</div>';
|
||||
} 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 '</td>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user