diff --git a/core/class/declarationtva.class.php b/core/class/declarationtva.class.php index 6994fab..7150bc1 100644 --- a/core/class/declarationtva.class.php +++ b/core/class/declarationtva.class.php @@ -897,12 +897,19 @@ class DeclarationTVA global $user; // Get declaration data - $declaration = $this->fetch($declaration_id); - if (!$declaration) { + $fetch_result = $this->fetch($declaration_id); + if (!$fetch_result) { $this->error = 'Declaration not found'; return false; } + // Create a declaration object with the fetched data + $declaration = new stdClass(); + $declaration->rowid = $this->rowid; + $declaration->declaration_name = $this->declaration_name; + $declaration->start_date = $this->start_date; + $declaration->end_date = $this->end_date; + // Get CA-3 lines data $ca3_lines = $this->getCA3Lines($declaration_id); if (empty($ca3_lines)) { @@ -1080,6 +1087,7 @@ class DeclarationTVA return $entries; } + error_log("DEBUG: Declaration object rowid: " . ($declaration->rowid ?? 'NULL')); $line8_details = $this->getCA3LineDetails($declaration->rowid, '08'); if (empty($line8_details) || empty($line8_details['account_details'])) {