Fix declaration object creation in createAccountingEntries
- Fix fetch() method usage - it returns 1/0, not an object - Create proper declaration object with rowid, name, and dates - Fixes 'No declaration dates found' error in getCA3LineDetails
This commit is contained in:
parent
cf9e3f76fa
commit
a03f883f28
@ -897,12 +897,19 @@ class DeclarationTVA
|
|||||||
global $user;
|
global $user;
|
||||||
|
|
||||||
// Get declaration data
|
// Get declaration data
|
||||||
$declaration = $this->fetch($declaration_id);
|
$fetch_result = $this->fetch($declaration_id);
|
||||||
if (!$declaration) {
|
if (!$fetch_result) {
|
||||||
$this->error = 'Declaration not found';
|
$this->error = 'Declaration not found';
|
||||||
return false;
|
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
|
// Get CA-3 lines data
|
||||||
$ca3_lines = $this->getCA3Lines($declaration_id);
|
$ca3_lines = $this->getCA3Lines($declaration_id);
|
||||||
if (empty($ca3_lines)) {
|
if (empty($ca3_lines)) {
|
||||||
@ -1080,6 +1087,7 @@ class DeclarationTVA
|
|||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error_log("DEBUG: Declaration object rowid: " . ($declaration->rowid ?? 'NULL'));
|
||||||
$line8_details = $this->getCA3LineDetails($declaration->rowid, '08');
|
$line8_details = $this->getCA3LineDetails($declaration->rowid, '08');
|
||||||
|
|
||||||
if (empty($line8_details) || empty($line8_details['account_details'])) {
|
if (empty($line8_details) || empty($line8_details['account_details'])) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user