Fix success condition - check entry ID instead of create() return value
- Use bookkeeping->id > 0 to check if entry was created successfully - create() method returns 0 but entry is actually created with valid ID - This is a common Dolibarr pattern where create() returns 0 for success - Check actual entry ID to determine success instead of return value
This commit is contained in:
parent
a678348f42
commit
b110313245
@ -1263,7 +1263,10 @@ class DeclarationTVA
|
||||
error_log("DEBUG: Debit entry error message: '" . $debit->error . "'");
|
||||
error_log("DEBUG: Debit entry ID after create: " . $debit->id);
|
||||
|
||||
if ($result <= 0) {
|
||||
// Check if entry was created successfully (ID > 0 means success)
|
||||
if ($debit->id > 0) {
|
||||
error_log("DEBUG: Debit entry created successfully with ID: " . $debit->id);
|
||||
} else {
|
||||
throw new Exception('Failed to create debit entry: ' . $debit->error);
|
||||
}
|
||||
}
|
||||
@ -1291,8 +1294,13 @@ class DeclarationTVA
|
||||
|
||||
$result = $credit->create($user);
|
||||
error_log("DEBUG: Credit entry create result: " . $result . " (type: " . gettype($result) . ")");
|
||||
error_log("DEBUG: Credit entry error message: '" . $credit->error . "'");
|
||||
error_log("DEBUG: Credit entry ID after create: " . $credit->id);
|
||||
|
||||
if ($result <= 0) {
|
||||
// Check if entry was created successfully (ID > 0 means success)
|
||||
if ($credit->id > 0) {
|
||||
error_log("DEBUG: Credit entry created successfully with ID: " . $credit->id);
|
||||
} else {
|
||||
throw new Exception('Failed to create credit entry: ' . $credit->error);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user