- Replace dol_gettext() with dol_translate() which is the correct Dolibarr function
- Fix fatal error: Call to undefined function dol_gettext()
- Use proper Dolibarr translation function for journal labels
- Use dol_gettext() to translate the journal label key to actual text
- Convert 'ACCOUNTING_MISCELLANEOUS_JOURNAL' to proper translated label
- Add debug logging to show both original key and translated text
- Fix journal label to match working OD journal entries
- Add debug logging to see what journal label is retrieved from database
- Help identify if the query is finding the correct journal
- Debug both debit and credit entry journal label retrieval
- Query accounting_journal table to get label for 'OD' journal
- Set journal_label field for both debit and credit entries
- Match the working OD journal entries that have proper journal labels
- Complete the missing fields identified in comparison
- Add label_operation = declaration_name for both debit and credit entries
- This field is critical for proper accounting entry creation
- Based on comparison with working OD journal entries
- Should fix the issue with debit/credit amounts being 0
- Remove verbose field-by-field debugging that might reset object properties
- Keep only essential montant verification before create()
- Remove extensive database queries that might interfere
- Focus on the core issue: montant field being reset to 0
- Add debugging to check total OD journal entries in system
- Add debugging to show recent OD journal entries with amounts
- Verify entries are being created in the correct journal
- Help identify if entries exist but are not visible in UI
- Remove single quotes from sens field (revert to 'D' and 'C')
- Add missing required fields: entity, date_creation, tms, fk_user_creation, fk_user_modification
- Ensure all Bookkeeping object properties are properly set
- Address potential missing field issues causing create() failures
- Change sens from 'D' to "'D'" for debit entries
- Change sens from 'C' to "'C'" for credit entries
- Address common issue where sens field needs quoted values
- Based on online research about Bookkeeping sens field issues
- Replace verbose JSON output with focused field-by-field debugging
- Show all key Bookkeeping fields with NULL detection
- Include entity, date_creation, tms, fk_user_creation, fk_user_modification
- Help identify which specific fields are missing or incorrect
- Add print_r() output for complete Bookkeeping object before create()
- Add JSON encoding of Bookkeeping object for detailed inspection
- Show all object properties and values
- Help identify missing or incorrect field values causing empty amounts
- Use price2num(amount, 'MT') to clean monetary values
- Use dol_mktime() to properly format dates
- Ensure amounts are properly formatted for accounting
- Follow Dolibarr standards for data formatting
- Change doc_date from dol_now() to declaration->end_date
- OD entries should be dated on the last day of the declaration month
- This matches accounting practice for VAT declarations
- Ensures entries appear in correct month in OD journal
- Show doc_date (operation date) for each entry
- Show date_creation (creation timestamp) for each entry
- Show tms (modification timestamp) for each entry
- Help identify if date filtering is causing journal display issues
- Show entity and date information for saved entries
- List all available journal codes in the system
- Help identify if journal code 'OD' exists and is correct
- Debug why entries don't appear in OD journal view
- Query database to see what values are actually saved
- Check montant, numero_compte, sens fields in database
- Verify if amounts are being saved correctly
- Help identify if issue is with saving or display
- Log all field values before create() call for both debit and credit entries
- Help identify which fields are empty or incorrect
- Debug the exact values being passed to Bookkeeping objects
- Show field-by-field breakdown to find missing values
- 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
- Check if account numbers exist in chart of accounts before creating entries
- Add detailed debugging for error messages and entry IDs
- Validate account existence to prevent creation failures
- Show exact error messages from Bookkeeping class
- Remove excessive debugging and field validation
- Use minimal field set like working example
- Add try/catch block for proper error handling
- Use dol_now() for doc_date like working example
- Simplify to essential fields only: doc_date, doc_ref, code_journal, numero_compte, label_compte, montant, sens, fk_doc, fk_user_author
- Start transaction with db->begin() before creating entries
- Commit transaction with db->commit() after all entries created
- Rollback transaction with db->rollback() on any failure
- Follow Dolibarr best practices for accounting entry creation
- Ensure entries are properly committed to database
- Check if account number exists in accounting_account table
- Compare with existing accounting entries to see field differences
- Help identify if account validation is causing the -1 return
- Debug the exact validation requirements
- Add date_creation and tms timestamps
- Add fk_user_creation and fk_user_modification fields
- These fields might be required by Dolibarr's Bookkeeping validation
- Ensure all required fields are set before create() call
- Log all Bookkeeping field values before create() call
- Check if journal code 'OD' exists in accounting_journal table
- Help identify which field or validation is causing the -1 return
- Debug the exact field values being passed to create()
- Show actual result value and type from create() method
- Help identify why result is truthy but not > 0
- Show both result value and error message in failure case
- Debug the exact return value from Bookkeeping::create()
- Remove direct SQL insert fallback that bypasses Dolibarr logic
- Use proper result checking: if (result > 0) for success
- Log actual entry IDs when successfully created
- Use bookkeeping->error for proper error messages
- Maintain Dolibarr's internal validation and business logic
- Add detailed debugging to check what's actually in accounting_bookkeeping table
- Add direct SQL insert fallback when Bookkeeping::create() fails
- Show recent entries in table to debug the issue
- Ensure entries are actually saved to database
- Create separate Bookkeeping instances for debit and credit
- Follow Dolibarr pattern: one entry per debit, one per credit
- Each entry has single montant with proper sens (D/C)
- Separate debug logging for debit vs credit entries
- Ensures proper double-entry bookkeeping structure
- Move Bookkeeping instantiation inside the loop
- Create fresh instance for each accounting entry
- Prevents field contamination between entries
- Ensures each entry is processed independently
- Use correct field names for Bookkeeping class
- Set all required fields: doc_date, doc_ref, code_journal, numero_compte, etc.
- Use proper debit/credit logic with sens field
- Set journal code to 'OD' for VAT declarations
- Link entries to declaration via fk_doc
- Update verification query to use correct field names
- Replace Bookkeeping::create() with direct SQL INSERT
- Bookkeeping class was returning success but not actually saving records
- Add detailed SQL logging to track insert operations
- Ensure entries are actually committed to database
- Add verification query after each bookkeeping create call
- Add final verification to count total entries created
- Help identify if entries are actually being saved to database
- Add debug logs to track bank account ID from config
- Add debug logs to show bank account query and results
- Help identify why bank account code is empty
- 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
- Add user parameter to createODJournalEntries method signature
- Pass user parameter from createAccountingEntries to createODJournalEntries
- Fixes user parameter getting lost between createAccountingEntries and saveAccountingEntries
- 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
- Add user parameter to submitDeclaration method signature
- Pass user object from view file to submitDeclaration method
- Remove redundant global user declaration
- Fixes null user parameter in bookkeeping create method
- Use htdocs/accountancy/class/bookkeeping.class.php
- Replace direct SQL with proper Dolibarr Bookkeeping class
- Maintains proper Dolibarr integration and error handling
- Remove dependency on non-existent AccountingBookkeeping class
- Use direct SQL INSERT into accounting_bookkeeping table
- Fixes 'Failed opening required' error for accounting class
- Creates accounting entries directly in database
- Add debug logs to track method calls and return values
- Help diagnose why account details are not being found
- Track account count returned by getCA3LineDetails
- Add debug logs to track CA-3 lines found
- Add debug logs to track OD entries creation
- Add debug logs to track line 8, 20, and balancing entries
- Help diagnose why no OD journal entries are being created
- Temporarily disable status validation to allow re-submission
- Add resetDeclarationStatus() method for testing
- Add reset button for submitted declarations
- Add French language strings for reset functionality
- Allows multiple submission attempts during testing
- Remove duplicate 'Create accounting entries' toggle from journal configuration
- Use existing 'Auto-create accounting entries' setting for submission workflow
- Clean up unused language strings
- Consolidate accounting entry control into single, clear setting
- Add comprehensive accounting integration with OD and bank journal entries
- Create configurable accounting entries toggle in setup
- Implement submission workflow with accounting entry creation
- Add proper error handling and validation
- Support VAT refund threshold logic for account selection
- Integrate with Dolibarr's AccountingBookkeeping class
- Add French language strings for new features