Add debugging and fix user parameter passing
- Add debug logs to track user parameter through method calls - Update createAccountingEntries to accept user parameter - Remove redundant global user declarations - Pass user parameter through entire accounting creation chain
This commit is contained in:
parent
99683fab10
commit
9afecbbac0
@ -890,12 +890,11 @@ class DeclarationTVA
|
|||||||
* Create accounting entries for declaration submission
|
* Create accounting entries for declaration submission
|
||||||
*
|
*
|
||||||
* @param int $declaration_id Declaration ID
|
* @param int $declaration_id Declaration ID
|
||||||
|
* @param object $user User object
|
||||||
* @return bool Success
|
* @return bool Success
|
||||||
*/
|
*/
|
||||||
public function createAccountingEntries($declaration_id)
|
public function createAccountingEntries($declaration_id, $user)
|
||||||
{
|
{
|
||||||
global $user;
|
|
||||||
|
|
||||||
// Get declaration data
|
// Get declaration data
|
||||||
$fetch_result = $this->fetch($declaration_id);
|
$fetch_result = $this->fetch($declaration_id);
|
||||||
if (!$fetch_result) {
|
if (!$fetch_result) {
|
||||||
@ -1295,6 +1294,8 @@ class DeclarationTVA
|
|||||||
*/
|
*/
|
||||||
public function submitDeclaration($declaration_id, $user)
|
public function submitDeclaration($declaration_id, $user)
|
||||||
{
|
{
|
||||||
|
error_log("DEBUG: submitDeclaration called with user: " . ($user ? "VALID" : "NULL"));
|
||||||
|
|
||||||
// Get declaration data
|
// Get declaration data
|
||||||
$declaration = $this->fetch($declaration_id);
|
$declaration = $this->fetch($declaration_id);
|
||||||
if (!$declaration) {
|
if (!$declaration) {
|
||||||
@ -1322,7 +1323,8 @@ class DeclarationTVA
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create accounting entries
|
// Create accounting entries
|
||||||
$accounting_result = $this->createAccountingEntries($declaration_id);
|
error_log("DEBUG: About to call createAccountingEntries with user: " . ($user ? "VALID" : "NULL"));
|
||||||
|
$accounting_result = $this->createAccountingEntries($declaration_id, $user);
|
||||||
if (!$accounting_result) {
|
if (!$accounting_result) {
|
||||||
$this->error = 'Failed to create accounting entries: ' . $this->error;
|
$this->error = 'Failed to create accounting entries: ' . $this->error;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user