Add debugging for VAT refund threshold configuration saving issue

This commit is contained in:
Frank Cools 2025-10-08 16:33:39 +02:00
parent 19b74db330
commit 181e3d7d74
2 changed files with 12 additions and 1 deletions

View File

@ -94,6 +94,11 @@ if ($action == 'update_vat_refund_threshold') {
'refund_threshold_enabled' => GETPOST('vat_refund_threshold_enabled', 'int')
);
// Debug: Log the received values
error_log("VAT Refund Threshold Debug - Received values:");
error_log("refund_threshold: " . $threshold_config['refund_threshold']);
error_log("refund_threshold_enabled: " . $threshold_config['refund_threshold_enabled']);
$updated = $config->updateVATRefundThresholdConfiguration($threshold_config);
if ($updated) {
setEventMessages($langs->trans("VATRefundThresholdConfigurationUpdated"), null, 'mesgs');

View File

@ -760,7 +760,13 @@ class DeclarationTVA_Config
public function updateVATRefundThresholdConfiguration($threshold_config)
{
foreach ($threshold_config as $key => $value) {
$this->set('vat_refund_' . $key, $value);
$config_key = 'vat_refund_' . $key;
error_log("Saving VAT refund threshold config: " . $config_key . " = " . $value);
$result = $this->set($config_key, $value);
if (!$result) {
error_log("Failed to save VAT refund threshold config: " . $config_key . " = " . $value);
return false;
}
}
return true;
}