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,15 +40,25 @@ if ($action == 'update_mappings') {
|
|||||||
$ca3_definitions = $config->getCA3LineDefinitions();
|
$ca3_definitions = $config->getCA3LineDefinitions();
|
||||||
$updated_count = 0;
|
$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) {
|
foreach ($ca3_definitions as $line => $definition) {
|
||||||
$account_codes = GETPOST('account_codes_' . $line, 'array');
|
$account_codes = GETPOST('account_codes_' . $line, 'array');
|
||||||
|
|
||||||
// Process all lines, even empty ones (to clear mappings)
|
// Process all lines that have form data
|
||||||
|
if (isset($_POST['account_codes_' . $line])) {
|
||||||
$result = $config->updateAccountMapping($line, $account_codes);
|
$result = $config->updateAccountMapping($line, $account_codes);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$updated_count++;
|
$updated_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($updated_count > 0) {
|
if ($updated_count > 0) {
|
||||||
setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs');
|
setEventMessages($langs->trans("ConfigurationUpdated"), null, 'mesgs');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user