- 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
- Changed PDF generation path from /documents/declarationtva/validated/ to /declarationtva/validated/
- Updated hasValidatedDocument() to look in /declarationtva/validated/
- Updated getValidatedPDFPath() to look in /declarationtva/validated/
- This removes the duplicate /documents in the file path
- Files will now be saved in /var/lib/dolibarr/declarationtva/validated/
- URLs will be /dolibarr/documents/declarationtva/validated/ (single /documents)
- Updated generateDetailedCA3PDF to save PDFs in /documents/declarationtva/validated/
- Updated hasValidatedDocument to look in /documents/declarationtva/validated/
- Updated getValidatedPDFPath to look in /documents/declarationtva/validated/
- Removed year/month directory structure
- Should now match the actual file location where PDFs are saved
- URLs should now work correctly
- Removed all error_log debug statements from production code
- Cleaned up hasValidatedDocument method
- Cleaned up declaration list processing
- Code is now production-ready
- PDF detection and generation are working correctly
- Added comprehensive error_log statements to track PDF detection
- Logs declaration ID, number, directory paths, and search patterns
- Shows all PDF files found in the directory
- Will help identify why PDF detection is failing
- Debug info will appear in PHP error logs
- Updated hasValidatedDocument() to use flexible file pattern matching
- Updated getValidatedPDFPath() with same flexible pattern
- First tries exact pattern: CA3_[declaration_number]_*.pdf
- Falls back to flexible pattern: CA3_*[declaration_number]*.pdf
- Should now detect PDFs with complex filenames like CA3_CA3-2025-05-20251002184011_2025-10-06.pdf
- Declaration list should now show green PDF icons for validated declarations
- Modified generateDetailedCA3PDF to save PDFs directly to /documents/declarationtva/YYYY/MM/
- Updated saveValidatedPDF to handle PDFs already in correct location
- Added debugging messages to show PDF generation success/failure
- Fixed path mismatch between PDF generation and document detection
- PDFs should now be properly generated and detected in declaration list
- Modified hasValidatedDocument() to check file system instead of database
- Added getValidatedPDFPath() method to get PDF file path
- Updated declaration list to show clickable PDF download links
- Added DownloadPDF translation in French and English
- PDF icons now link directly to downloadable PDF files
- Fixed issue where validated declarations didn't show PDF availability
- Added ECM integration toggle for easy enable/disable
- Temporarily disabled ECM integration to prevent fatal errors
- Added debugging logs to track ECM files path resolution
- PDF saving to disk still works without ECM integration
- Declaration validation will work without document management
- Can be re-enabled once ECM files path is properly resolved
- Create dedicated VAT declarations folder structure under Dolibarr documents
- Organize by year and month: /documents/declarationtva/YYYY/MM/
- Updated PDF saving to use proper directory structure
- Enhanced ECM file records with proper filepath and descriptions
- Added helper methods for directory management
- Better document organization following Dolibarr conventions
- VAT declarations now have their own dedicated space
- Updated paths to include correct ECM files location
- Added multiple fallback paths for ecmfiles.class.php
- Prioritized /ecm/class/ path over /core/class/ path
- Enhanced error logging to show all attempted paths
- Should resolve the 'Failed opening required' error
- ECM files integration should now work properly
- Added unvalidateDeclaration() method to DeclarationTVA class
- Added unvalidate action handler in declarationtva_view.php
- Added red 'Unvalidate' button for validated declarations
- Added confirmation dialog for unvalidate action
- Added French and English language strings
- Allows reverting validated declarations back to draft status
- Useful for testing validation process multiple times
- Made ECM files integration optional and graceful
- Added file existence check before requiring ecmfiles.class.php
- Wrapped ECM file creation in try-catch to prevent fatal errors
- PDF is still saved to disk even if ECM integration fails
- Added detailed error logging for troubleshooting
- System now works regardless of ECM files availability
- Enhanced validateDeclaration() to check for column existence
- Falls back to basic validation if enhanced columns don't exist
- Updated migration script with proper column existence checks
- Uses dynamic SQL to avoid errors on existing columns
- System now works with or without the additional columns
- Graceful degradation for different database states
- Removed all error_log debug statements from PDF generation
- Removed debug logging from CA-3 data processing
- Removed debug logging from account amount calculations
- Cleaned up merge methods debug output
- Production-ready code without debug noise
- Added comprehensive PDF export combining CA-3 form with detailed breakdown pages
- Implemented pdftk-based PDF merging that preserves form fields
- Added support for new CA-3 lines (25, 26, 27, TD, 28, 32) with conditional visibility
- Fixed multi-select configuration saving issues
- Enhanced error handling and debugging for PDF generation
- Added French status translation for detailed PDFs
- Optimized page breaks to reduce paper usage
- Improved form field preservation during PDF merging
Technical improvements:
- Better error handling with comprehensive logging
- Modular PDF generation with fallback options
- Fixed pdftk filename conflicts
- Enhanced debugging capabilities
- Status translation without external dependencies
- Removed debug logging that was added to troubleshoot line 08 display issues
- The issue was identified as database field length limit (varchar(255) vs TEXT)
- Calculation is working correctly - line 08 shows base=1410.57, vat=186.34, total=1596.91
- User needs to run the database migration to fix the line_label field length
- Added debug logging to see how many BASE and VAT mappings are found
- Added logging to show which accounts are being processed and their amounts
- Added logging to show available mappings when none are found for a line
- This will help identify why line 08 base amounts are not displaying in the main view
- Created migration to change line_label from varchar(255) to TEXT
- Added truncation logic to prevent future line_label length issues (1000 char limit)
- This fixes the issue where 11 accounts mapped to line 08 base caused display problems
- The calculation should now work correctly with any number of account mappings
- Added comprehensive field naming documentation (CA3_FIELD_NAMING.md)
- Implemented PDFTK-based PDF form filling with FDF generation
- Added PDFTK installation guide for Linux/Mac/Windows
- Enhanced PDF generation with company data integration
- Added new CA-3 lines: F1, F2 (intracom acquisitions), E1-E6, F6-F8, line 18
- Updated section structure: merged Section C into Section B as sub-section
- Added lines 19, 20 to TVA DÉDUCTIBLE sub-section
- Updated all field descriptions to match official CA-3 form
- Improved visual hierarchy with dark blue section headers
- Enhanced calculation logic for VAT deductible amounts
- Added comprehensive language translations
- Updated database schema with new fields
- Fixed font settings to use Courier New 9pt for official documents
Fixed:
- Removed old getAccountMappings() method on line 615
- Kept the new version that joins with chart of accounts
- This fixes the 'Cannot redeclare' PHP Fatal error
The new method properly retrieves account labels from Dolibarr's accounting_account table.
Fixed:
- Added missing getAccountMappings() method to DeclarationTVA class
- Joins with Dolibarr's accounting_account table to get labels
- Retrieves account labels from chart of accounts (llx_accounting_account)
- Falls back to stored label if chart of accounts label not available
- Returns array with rowid, ca3_line, account_code, account_label, vat_rate, is_active
This fixes the issue where account labels were not showing in dropdown panels.
Fixed:
- Grouped BASE and VAT accounts separately for lines 08, 09, 9B
- Added clear section headers: 'Base Accounts (Sales)' and 'VAT Accounts'
- Improved visual organization of account breakdown
- Removed debugging code
- Added translations for new section headers
This ensures users can clearly see which accounts contribute to base amounts vs VAT amounts for the special lines.
Fixed:
- Updated getCA3LineDetails() to handle special cases for lines 08, 09, 9B
- These lines have _BASE and _VAT suffixes in the database
- Added proper matching logic for both normal lines and special cases
- Added debugging to AJAX endpoint and backend method
- Added error logging to trace mapping issues
This should fix the issue where only A1 works but other lines show no accounts.
Features added:
- New getCA3LineDetails() method in DeclarationTVA class
- New declarationtva_line_details.php page for detailed view
- All CA-3 line codes are now clickable in declaration view
- Detailed breakdown shows:
* Account codes and labels
* Base amounts, VAT amounts, total amounts
* Mapping types (A1, 08_BASE, 08_VAT, etc.)
* Calculated totals vs account totals
- Added comprehensive translations for detailed view
- Navigation breadcrumbs and back buttons
- Professional styling with Dolibarr UI components
This provides complete transparency into which accounts contribute to each CA-3 line without touching the calculation logic.