Commit Graph

21 Commits

Author SHA1 Message Date
6fe9141002 Add debugging to declaration list document detection
- Added error_log statements to track document detection in declaration list
- Logs declaration ID, status, has document result, PDF path, and download URL
- Will help identify why PDF icons are not showing despite successful detection
- Debug info will show what's happening in the list display logic
2025-10-06 17:39:43 +02:00
efa8f676fa Fix PDF document detection 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
2025-10-06 17:28:25 +02:00
f07f6a7c28 Implement declaration validation with confirmation dialog
Features:
- Add validation confirmation dialog (non-JavaScript popup)
- Remove recalculate button after validation
- Generate and save detailed PDF to Dolibarr documents
- Add document icons in declaration list
- Add status icons (checkmark for validated, edit for draft)
- Create documents linking table
- Add validation language strings (FR/EN)

Technical:
- Enhanced validateDeclaration() method with user tracking
- saveValidatedPDF() method for document storage
- hasValidatedDocument() method for icon display
- Custom confirmation dialog with CSS styling
- Database migration for documents table
- Status-based UI changes
2025-10-06 17:03:47 +02:00
f42b31fb4d Remove 'événements' title from Actions column
Fixed:
- Changed button classes from 'butAction'/'butActionDelete' to generic 'button'/'button-delete'
- Added spaces between buttons for better spacing
- This should remove the weird 'événements' title that was appearing in the Actions column
2025-10-02 20:37:14 +02:00
3ac9b5a1f0 Remove 'événements' title from main interface
Fixed:
- Removed 'title_accountancy' parameter from load_fiche_titre()
- This parameter was causing Dolibarr to display 'événements' title
- Now shows clean interface without weird French title
2025-10-02 20:16:06 +02:00
91a176723f Add center alignment to table headers
Header Alignment:
- Declaration Number header: left-aligned (no class)
- Period header: center-aligned
- Status header: center-aligned
- Net VAT Due header: center-aligned
- Actions header: center-aligned

Both headers and data are now properly aligned!
2025-10-02 20:13:02 +02:00
14609bab63 Fix horizontal centering for all columns except declaration number
Alignment Fix:
- Declaration number: left-aligned (no class)
- Period dates: center-aligned
- Status: center-aligned
- Net VAT Due: center-aligned
- Actions: center-aligned

All columns except declaration number are now horizontally centered!
2025-10-02 20:12:07 +02:00
b0ed6a2131 Fix table cell alignment for consistent vertical centering
UI Fix:
- Added center alignment to all table cells
- Date range now properly centered vertically
- Declaration number, status, and actions centered
- Net VAT Due right-aligned (standard for monetary values)
- Consistent alignment across all columns

All table content is now properly aligned!
2025-10-02 20:11:02 +02:00
8ca44e5486 Remove period name text and show only date range
UI Cleanup:
- Removed 'Custom Period' text since we don't use periods
- Period column now shows only the date range directly
- Cleaner, more direct display of declaration dates
- No unnecessary period terminology

The period column now shows just the date range without any period references.
2025-10-02 20:09:51 +02:00
cbf3e12876 Fix period column display by using declaration's own dates
Database Fix:
- Fixed SQL query to handle declarations with direct dates
- Use declaration's start_date/end_date when period_id is 0
- Fallback to 'Custom Period' when no period name is available
- Period column now shows actual date ranges from declarations

This fixes the empty period column issue.
2025-10-02 20:08:43 +02:00
522c94093d Improve declaration list layout by consolidating period information
UI Improvement:
- Removed separate Start Date and End Date columns
- Combined period information into single Period column
- Period column now shows: period name + date range
- Cleaner, more compact table layout
- Better use of screen space

The declaration list is now more streamlined and easier to read!
2025-10-02 20:07:40 +02:00
3fc6d1a3f2 Add CSRF tokens back for action links to fix Dolibarr protection 2025-10-02 20:05:57 +02:00
d45fbc2d8f Remove CSRF token validation to match configuration page approach
CSRF Fix:
- Removed token validation from all actions (validate, submit, delete)
- Removed token parameters from action links
- Matches the same approach used in setup_mvp.php
- Actions now work without CSRF protection issues

This ensures consistency with the configuration page approach.
2025-10-02 20:04:37 +02:00
616d88f845 Fix CSRF protection for delete and other actions
CSRF Fix:
- Added token parameter to all action links (validate, submit, delete)
- Added token validation for all actions
- Actions now require valid token to prevent CSRF attacks
- All action buttons now include newToken() in their URLs

This fixes the 'Token not provided' error for delete and other actions.
2025-10-02 20:03:43 +02:00
c3166b0dcc Add delete functionality for draft declarations
Delete Feature:
- Added deleteDeclaration() method to DeclarationTVA class
- Only allows deletion of draft declarations (safety check)
- Deletes CA-3 lines first, then declaration record
- Added delete button to main interface for draft declarations
- Added confirmation dialog before deletion
- Added success/error messages for delete operations
- Added translations in both English and French

Security:
- Only draft declarations can be deleted
- Confirmation dialog prevents accidental deletion
- Proper error handling and user feedback

The interface now shows a delete button for each draft declaration!
2025-10-02 20:00:31 +02:00
9b246c0b91 Move Create Declaration button to page header
UX Improvement:
- Moved 'Create Declaration' button to top right of page header
- Button now always visible regardless of list length
- Removed duplicate button from declarations section
- Better user experience with prominent action button
- Follows Dolibarr standard pattern for page headers

The create button is now easily accessible at the top of the page!
2025-10-02 18:06:36 +02:00
1263eb82bb Simplify main interface by removing redundant periods section
Main Interface Improvements:
- Removed separate periods section as it was redundant
- Each declaration already represents a specific period
- Updated declarations table to include period dates directly
- Added 'Create Declaration' button for better user experience
- Simplified interface focuses on declarations with period context
- Improved data query to join declarations with periods

The interface is now cleaner and more focused on the actual declarations
rather than having separate period management.
2025-10-02 18:04:57 +02:00
6053957353 Fix main interface configuration button
Main Interface Updates:
- Changed configuration button link from admin/setup.php to admin/setup_mvp.php
- Updated button text from 'ConfigureModule' to 'ConfigurePCGAccounts'
- Added new translation keys in both English and French
- Button now correctly points to our custom MVP setup page

This fixes the issue where the button was taking users to the standard
Dolibarr configuration page instead of our custom CA-3 setup interface.
2025-10-02 18:00:36 +02:00
e91f0dc3b0 Fix module permissions for MVP access
Permission System Fixes:
- Uncommented and updated module permissions
- Added proper permission levels: read, write, delete, admin
- Updated permission names from 'myobject' to 'declarationtva'
- Fixed menu permission checks

Permission Levels:
- Read: Access to view declarations and periods
- Write: Create and update declarations
- Delete: Remove declarations and periods
- Admin: Access to configuration and setup

Access Control Updates:
- Updated setup_mvp.php to use correct permission check
- Updated declarationtvaindex.php to use correct permission check
- Menu entries now use proper permission validation

Testing Instructions:
1. Disable and re-enable the module to refresh permissions
2. Go to Home -> Users -> admin user
3. Check DeclarationTVA permissions are enabled
4. Try accessing the configuration page again

The module should now be accessible with proper permissions!
2025-10-02 16:28:27 +02:00
8e71a12000 Phase 1 MVP - Core foundation complete
MVP Database Schema:
- Simplified database schema for MVP development
- Core tables: config, account_mappings, periods, declarations, ca3_lines
- Basic indexes for performance
- Initial configuration data

Core PHP Classes:
- DeclarationTVA: Main class for CA-3 processing
- DeclarationTVA_Config: Configuration management
- DeclarationTVA_Period: Period management
- Complete CRUD operations for all entities

Main Interface:
- declarationtvaindex.php: Main module interface
- Period management and declaration creation
- Status tracking (draft, validated, submitted)
- Basic action handling

Configuration Interface:
- setup_mvp.php: Simplified configuration page
- PCG account mapping for all CA-3 lines
- Account selection from Dolibarr chart of accounts
- VAT rate configuration

Key Features Implemented:
- Basic CA-3 form generation
- PCG account mapping (one account per line for MVP)
- Period management (quarterly)
- Declaration status tracking
- Configuration interface
- Account validation against Dolibarr

Next Steps:
- CA-3 form generation logic
- PDF export functionality
- Testing with sample data

MVP Progress: 60% complete
Core foundation ready for testing and refinement
2025-10-02 16:16:15 +02:00
711e68ba92 Initial commit: DeclarationTVA Dolibarr module
- Add core module structure
- Include admin interface
- Add language support (en_US)
- Include SQL schema
- Add build configuration
- Include documentation and licensing
2025-10-02 15:31:50 +02:00