Commit Graph

6 Commits

Author SHA1 Message Date
9b7c460e61 Add automatic table creation to declaration create page
Database Fix:
- Added automatic table creation for missing tables
- Creates llx_declarationtva_declarations, llx_declarationtva_periods, llx_declarationtva_ca3_lines
- Matches the same approach used in setup_mvp.php
- Ensures all required tables exist before processing

This fixes the 'Table doesn't exist' error when creating declarations.
2025-10-02 18:19:09 +02:00
12c5329577 Remove CSRF token validation to match configuration page
CSRF Fix:
- Removed dolibarr_checkToken() validation
- Simplified form processing logic
- Matches the same approach used in setup_mvp.php
- Form now works without CSRF protection issues

This ensures consistency with the configuration page approach.
2025-10-02 18:17:58 +02:00
480d3c5deb Fix CSRF token validation function
Security Fix:
- Changed checkToken() to dolibarr_checkToken()
- Uses the correct Dolibarr CSRF protection function
- Fixes 'Call to undefined function checkToken()' error

The form should now work properly with CSRF protection.
2025-10-02 18:16:07 +02:00
54d0ceaa03 Add CSRF protection to declaration creation form
Security Fixes:
- Added CSRF token field to form
- Added token validation in form processing
- Added proper error handling for missing dates
- Added ErrorMissingDates translation in both languages
- Form now properly validates CSRF tokens before processing

This fixes the 'Token not provided' error when submitting the form.
2025-10-02 18:14:58 +02:00
e64c1f5a6d Simplify declaration creation by removing period selection
Create Declaration Improvements:
- Removed period dropdown selection
- Moved date fields to top of form
- Made start_date and end_date mandatory fields
- Added createDeclarationWithDates() method to DeclarationTVA class
- Added generateDeclarationNumberFromDates() helper method
- Simplified form with direct date input
- Better user experience with mandatory date fields

The form is now more straightforward - users just enter the dates
directly instead of selecting from predefined periods.
2025-10-02 18:13:16 +02:00
c61a964f14 Create declaration creation and view pages
New Pages Added:
- declarationtva_create.php: Complete declaration creation form
- declarationtva_view.php: Declaration details and CA-3 amounts display

Features Implemented:
- Period selection for new declarations
- Declaration naming with helpful examples
- Optional date range override
- Complete CA-3 form structure display
- Status-based action buttons (Validate/Submit)
- Proper error handling and success messages
- Full bilingual support (English/French)

Create Page Features:
- Period dropdown with date ranges
- Declaration name field with help text
- Optional date override
- Configuration reminder with link to setup

View Page Features:
- Complete declaration details
- CA-3 amounts table with all 16 lines
- Status-based actions
- Navigation back to main list

The module now has a complete declaration workflow!
2025-10-02 18:09:04 +02:00