diff --git a/admin/setup_mvp.php b/admin/setup_mvp.php index fd2804e..c952143 100644 --- a/admin/setup_mvp.php +++ b/admin/setup_mvp.php @@ -40,13 +40,6 @@ 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'); diff --git a/core/class/declarationtva_config.class.php b/core/class/declarationtva_config.class.php index b45a400..223d96a 100644 --- a/core/class/declarationtva_config.class.php +++ b/core/class/declarationtva_config.class.php @@ -102,15 +102,11 @@ class DeclarationTVA_Config */ public function updateAccountMapping($ca3_line, $account_codes) { - // Debug: Log what we're trying to save - error_log("DeclarationTVA: updateAccountMapping called for line $ca3_line with codes: " . print_r($account_codes, true)); - // First, deactivate all existing mappings for this CA-3 line $sql = "UPDATE " . MAIN_DB_PREFIX . "declarationtva_account_mappings SET is_active = 0 WHERE entity = " . $this->entity . " AND ca3_line = '" . $this->db->escape($ca3_line) . "'"; - $result1 = $this->db->query($sql); - error_log("DeclarationTVA: Deactivate query result: " . ($result1 ? 'SUCCESS' : 'FAILED - ' . $this->db->lasterror())); + $this->db->query($sql); // Then insert/activate new mappings if (!empty($account_codes)) { @@ -122,7 +118,6 @@ class DeclarationTVA_Config AND ca3_line = '" . $this->db->escape($ca3_line) . "' AND account_code = '" . $this->db->escape($account_code) . "'"; $check_result = $this->db->query($check_sql); - error_log("DeclarationTVA: Check query result: " . ($check_result ? 'SUCCESS' : 'FAILED - ' . $this->db->lasterror())); if ($check_result && $this->db->num_rows($check_result) > 0) { // Update existing mapping (reactivate it) @@ -131,16 +126,14 @@ class DeclarationTVA_Config WHERE entity = " . $this->entity . " AND ca3_line = '" . $this->db->escape($ca3_line) . "' AND account_code = '" . $this->db->escape($account_code) . "'"; - $result2 = $this->db->query($sql); - error_log("DeclarationTVA: Update query result: " . ($result2 ? 'SUCCESS' : 'FAILED - ' . $this->db->lasterror())); + $this->db->query($sql); } else { // Insert new mapping $sql = "INSERT INTO " . MAIN_DB_PREFIX . "declarationtva_account_mappings (entity, ca3_line, account_code, account_label, vat_rate, is_active, created_date) VALUES (" . $this->entity . ", '" . $this->db->escape($ca3_line) . "', '" . $this->db->escape($account_code) . "', '', 0, 1, NOW())"; - $result3 = $this->db->query($sql); - error_log("DeclarationTVA: Insert query result: " . ($result3 ? 'SUCCESS' : 'FAILED - ' . $this->db->lasterror())); + $this->db->query($sql); } } } @@ -202,9 +195,6 @@ class DeclarationTVA_Config } } - // Debug: Log what we're retrieving - error_log("DeclarationTVA: getAccountMappingsByLine retrieved: " . print_r($mappings, true)); - return $mappings; }