Add debugging to investigate account mapping issues
Debug Features: - Added debug output to show what form data is being submitted - Shows which lines have data and which are empty/not set - Helps identify if Dolibarr multiselectarray sends empty arrays - Will help diagnose why accounts are being lost This will help us understand what's happening with the form submission!
This commit is contained in:
parent
67c01df597
commit
1a7663344d
@ -40,13 +40,23 @@ if ($action == 'update_mappings') {
|
||||
$ca3_definitions = $config->getCA3LineDefinitions();
|
||||
$updated_count = 0;
|
||||
|
||||
// Debug: Show what's being submitted
|
||||
$debug_info = array();
|
||||
foreach ($ca3_definitions as $line => $definition) {
|
||||
$account_codes = GETPOST('account_codes_' . $line, 'array');
|
||||
$debug_info[] = "$line: " . (is_array($account_codes) ? implode(',', $account_codes) : 'not set');
|
||||
}
|
||||
setEventMessages("Debug: Form data - " . implode(' | ', $debug_info), null, 'warnings');
|
||||
|
||||
foreach ($ca3_definitions as $line => $definition) {
|
||||
$account_codes = GETPOST('account_codes_' . $line, 'array');
|
||||
|
||||
// Process all lines, even empty ones (to clear mappings)
|
||||
$result = $config->updateAccountMapping($line, $account_codes);
|
||||
if ($result) {
|
||||
$updated_count++;
|
||||
// Process all lines that have form data
|
||||
if (isset($_POST['account_codes_' . $line])) {
|
||||
$result = $config->updateAccountMapping($line, $account_codes);
|
||||
if ($result) {
|
||||
$updated_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user