Add debugging to bookkeeping entry creation
- Add debug logs to track each accounting entry being created - Add debug logs to track bookkeeping create results - Help identify why entries are not being saved to database
This commit is contained in:
parent
3638c5854e
commit
2bdb44ee00
@ -1225,6 +1225,8 @@ class DeclarationTVA
|
|||||||
$bookkeeping = new Bookkeeping($this->db);
|
$bookkeeping = new Bookkeeping($this->db);
|
||||||
|
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
error_log("DEBUG: Creating accounting entry for account: " . $entry['account_code'] . ", debit: " . $entry['debit'] . ", credit: " . $entry['credit']);
|
||||||
|
|
||||||
// Create accounting entry
|
// Create accounting entry
|
||||||
$bookkeeping->doc_type = 'declarationtva';
|
$bookkeeping->doc_type = 'declarationtva';
|
||||||
$bookkeeping->doc_ref = $declaration->declaration_name;
|
$bookkeeping->doc_ref = $declaration->declaration_name;
|
||||||
@ -1237,6 +1239,7 @@ class DeclarationTVA
|
|||||||
$bookkeeping->entity = $this->entity;
|
$bookkeeping->entity = $this->entity;
|
||||||
|
|
||||||
$result = $bookkeeping->create($user);
|
$result = $bookkeeping->create($user);
|
||||||
|
error_log("DEBUG: Bookkeeping create result: " . ($result ? "SUCCESS" : "FAILED - " . $bookkeeping->error));
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->error = 'Failed to create accounting entry: ' . $bookkeeping->error;
|
$this->error = 'Failed to create accounting entry: ' . $bookkeeping->error;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user