Commit Graph

803 Commits

Author SHA1 Message Date
Dries Peeters a24d515247 fix(migrations): add idempotency checks to additional migrations
Add existence checks to older migrations (002, 004, 013, 021, 031, 034, 044,
046, 071, 086, 087) to prevent errors when objects already exist.

Also fixes syntax errors in migrations 046 and 086 where index creation
code was incorrectly placed outside try/except blocks.

All affected migrations now:
- Check for table/column/index existence before creating
- Handle existing objects gracefully with informative messages
- Have safe downgrade functions
- Use proper try/except error handling
2026-01-04 04:34:56 +01:00
Dries Peeters fc6e1bb733 fix(migrations): add idempotency checks to recent migrations
Add existence checks to recent migrations (032, 049, 053, 055, 058, 064, 099)
to prevent DuplicateTable and DuplicateColumn errors. These migrations now:

- Check if tables/columns exist before creating them
- Handle cases where objects already exist gracefully
- Provide informative messages about operations
- Have safe downgrade functions with existence checks

This makes migrations more resilient to partial failures and manual
schema changes.
2026-01-04 04:34:52 +01:00
Dries Peeters 1fa86d7706 fix(migrations): add idempotency check for invoice_peppol_transmissions table
Fix migration 098 to check if invoice_peppol_transmissions table exists
before creating it. This prevents DuplicateTable errors when the migration
is run on databases where the table was already created manually or
during a previous partial migration attempt.

The migration now:
- Checks for table existence before creating
- Handles existing tables gracefully
- Provides informative messages
- Has safe downgrade function
2026-01-04 04:34:48 +01:00
Dries Peeters a2156de296 Update setup.py 2026-01-03 20:48:40 +01:00
Dries Peeters f7fe8da015 i18n: update translations for all supported languages
- Update translation files for Arabic, German, English, Spanish
- Update Finnish, French, Hebrew, Italian translations
- Update Norwegian (nb/no) and Dutch translations
- Sync translations across all language files
2026-01-03 20:28:07 +01:00
Dries Peeters 6217dc69ae ui: enhance frontend JavaScript and admin settings
- Update enhanced-ui.js with improved functionality
- Enhance smart-notifications.js for better user feedback
- Improve toast-notifications.js messaging system
- Update admin settings template with better UX
2026-01-03 20:28:04 +01:00
Dries Peeters 29316570fa feat: improve project templates functionality
- Enhance project templates routes and handlers
- Update create and edit templates with better UX
- Improve template management and validation
2026-01-03 20:28:00 +01:00
Dries Peeters eb0cd0005e feat: enhance inventory management features
- Update stock movement model with improved functionality
- Enhance inventory routes and API endpoints
- Improve inventory templates for movements, reports, and stock items
- Add better history tracking and valuation reporting
2026-01-03 20:27:54 +01:00
Dries Peeters 7c169fb401 refactor: improve application initialization and migration handling
- Update app factory pattern with better error handling
- Enhance migration environment configuration
- Improve database initialization and recovery logic
- Add better support for bootstrap and migration modes
2026-01-03 20:27:51 +01:00
Dries Peeters 7dc430405d docs: add database recovery documentation and reset scripts
- Add comprehensive DATABASE_RECOVERY.md with automatic cleanup details
- Add cross-platform database reset scripts (bat, py, sh)
- Document automatic corruption detection and recovery
- Include manual recovery procedures and safety warnings
2026-01-03 20:27:48 +01:00
Dries Peeters e8bf79b325 build: precompile translations at Docker build time
- Add pybabel compile step in Dockerfile for faster startup
- Prevents runtime translation compilation overhead
- Gracefully handles missing Babel during build
2026-01-03 20:27:44 +01:00
Dries Peeters 9a6ede654f Merge pull request #386 from DRYTRIX/rc/v4.9.0
feat: add Peppol e-invoicing and stock lot valuation
v4.9.0
2026-01-03 07:02:27 +01:00
Dries Peeters 753b98d272 feat: add Peppol e-invoicing and stock lot valuation
Add Peppol BIS Billing 3.0 (UBL) invoice sending via a configurable access point, including admin-configurable settings, per-invoice send history, and documentation/README updates.

Also introduce stock lots/allocations (valuation layers) with supporting inventory route/report/UI updates and hardened startup migration handling.
2026-01-03 07:00:30 +01:00
Dries Peeters c5666f5eae Merge pull request #384 from DRYTRIX/rc/v4.8.12
fix: make migration 081 tolerant of existing settings columns
v4.8.12
2026-01-02 19:08:30 +01:00
Dries Peeters 1ea87c81e5 fix: make migration 081 tolerant of existing settings columns
Some legacy/partially-upgraded databases already have one or more integration OAuth columns in settings (e.g. google_calendar_client_id). Only add missing columns and set defaults for columns that exist so upgrades don't fail with DuplicateColumn.

Bump version to 4.8.12.
2026-01-02 19:05:46 +01:00
Dries Peeters 51a1af4e66 Merge pull request #383 from DRYTRIX/rc/v4.8.11
Rc/v4.8.11
v4.8.11
2026-01-02 17:22:35 +01:00
Dries Peeters bd59488132 fix: make template-related migrations idempotent
Avoid DuplicateTable/duplicate index errors on partially-migrated databases by skipping creation of existing template tables (quote_templates, project_templates, time_entry_templates) and only creating missing indexes/columns.

Also bump version to 4.8.11.
2026-01-02 17:19:19 +01:00
Dries Peeters dcc4f87769 fix: make migration 075 idempotent for existing link_templates
Skip creating link_templates when it already exists and only create missing indexes, so partially-migrated customer databases can continue upgrading.
2026-01-02 17:12:18 +01:00
Dries Peeters 037b45a3c4 Merge pull request #382 from DRYTRIX/rc/v4.8.10
Rc/v4.8.10
v4.8.10
2026-01-02 16:05:11 +01:00
Dries Peeters dd4a5e2f21 Update cd-release.yml 2026-01-02 16:02:04 +01:00
Dries Peeters 7f209751ab fix: harden Alembic upgrades on legacy databases
Prevent Postgres upgrades from failing when alembic_version.version_num is too small for long revision IDs, and add an alias migration to bridge older installs that recorded '067_add_integration_credentials'.
2026-01-02 15:53:51 +01:00
Dries Peeters 71a71d0536 Merge pull request #381 from DRYTRIX/rc/v4.8.9
Rc/v4.8.9
v4.8.9
2026-01-02 07:55:23 +01:00
Dries Peeters e177c25818 Bump version: 4.8.9 2026-01-02 07:53:28 +01:00
Dries Peeters 3218ab012a feat: expand client portal and approval workflows
Add new client portal pages (dashboard, approvals, notifications, documents, reports) and extend API/routes/services to support client approvals, invoices/quotes views, and related notifications.

Update email templates and docs; add/adjust tests for new models/routes.
2026-01-02 07:52:32 +01:00
Dries Peeters 86f7946120 fix: resolve SQLAlchemy reserved word conflict in ClientNotification model
- Rename 'metadata' column to 'extra_data' in ClientNotification model
  to avoid SQLAlchemy Declarative API reserved word conflict
- Update ClientNotificationService to use 'extra_data' instead of 'metadata'
- Maintain API compatibility by returning 'metadata' key in to_dict() method
- Update migration to create 'extra_data' column instead of 'metadata'
- Improve migration idempotency and SQLite compatibility with proper checks
- Enhance backup directory handling with configurable BACKUP_FOLDER support
- Update admin routes to use centralized backup directory function

This fixes the application startup error:
  sqlalchemy.exc.InvalidRequestError: Attribute name 'metadata' is reserved
  when using the Declarative API.

The migration is now idempotent and handles both PostgreSQL and SQLite
databases safely.
2026-01-02 07:50:04 +01:00
Dries Peeters b081e6d2dc Fix backup storage path in Docker
Default admin backups to a writable, configurable folder (BACKUP_FOLDER/BACKUP_DIR, defaulting to /data/uploads/backups) to avoid permission denied errors in non-root containers.

Also update local-test compose and docs to reflect the backup location.
2026-01-02 07:39:04 +01:00
Dries Peeters d6788570fe Merge pull request #379 from DRYTRIX/rc/v4.8.8
Rc/v4.8.8
v4.8.8
2026-01-01 13:32:22 +01:00
Dries Peeters f054f52c17 Version Bump 2026-01-01 13:31:46 +01:00
Dries Peeters b9b7612633 Fix migration 091: Handle existing integration_external_event_links table
The migration was failing with DuplicateTable error when the table
already existed in the database. This can happen when:
- The table was created manually
- A previous migration attempt partially succeeded
- Database state is out of sync with Alembic version tracking

Changes:
- Add _has_table() helper to check table existence
- Add _has_index() helper to check index existence
- Make upgrade() idempotent by checking before creating
- Make downgrade() safe by checking before dropping
- Follow same pattern as other migrations (018, 037)

This allows the migration to run successfully even when the table
already exists, creating only missing indexes if needed.
2026-01-01 13:30:23 +01:00
Dries Peeters f0fa2af563 Merge pull request #377 from DRYTRIX/rc/v4.8.7
Rc/v4.8.7
v4.8.7
2026-01-01 09:19:44 +01:00
Dries Peeters f562768e01 Version Bump v4.8.7 2026-01-01 09:19:04 +01:00
Dries Peeters 427074398c Improve migration robustness and add missing schema columns
- Refactor migrations with idempotency checks and better error handling
  * Add SQLAlchemy inspector checks for table/column existence
  * Improve error messages and handling for schema operations
  * Make migrations safe to run multiple times
  * Update 27 migration files with enhanced error handling patterns

- Add missing schema columns via new migrations
  * Migration 095: Add ui_show_issues column to users table
  * Migration 096: Add portal_issues_enabled column to clients table

- Enhance Settings model error handling
  * Improve detection of schema errors (table/column missing)
  * Better handling of SQLAlchemy exceptions during migrations
  * More comprehensive error checking for OperationalErrors

- Fix database auto-switching logic in app initialization
  * Respect explicit DATABASE_URL setting to prevent unwanted switches
  * Only auto-switch to PostgreSQL when not explicitly configured

- Update docker entrypoint script with migration improvements
2026-01-01 09:15:31 +01:00
Dries Peeters 1be138f42a Merge pull request #376 from DRYTRIX/rc/v4.8.6
Rc/v4.8.6
v4.8.6
2025-12-31 11:52:55 +01:00
Dries Peeters 0dedb5e782 Update setup.py 2025-12-31 11:52:13 +01:00
Dries Peeters 3e75d59349 Fixed Entrypoint 2025-12-31 11:51:57 +01:00
Dries Peeters 42ad764c74 Merge pull request #374 from DRYTRIX/rc/v4.8.5
Rc/v4.8.5
v4.8.5
2025-12-31 07:06:56 +01:00
Dries Peeters b709e1f08d Update setup.py 2025-12-31 07:04:06 +01:00
Dries Peeters 7f60d8db1e Update entrypoint_fixed.sh 2025-12-31 07:03:53 +01:00
Dries Peeters 4d3db70038 Merge pull request #372 from DRYTRIX/rc/v4.8.4
Rc/v4.8.4
v4.8.4
2025-12-30 20:44:27 +01:00
Dries Peeters 123fc067da version bump 4.8.4 2025-12-30 20:42:20 +01:00
Dries Peeters a42a84ecdc Fix layout inconsistencies and remove footer from all pages
- Replace bg-white dark:bg-gray-800 with bg-card-light dark:bg-card-dark across all templates for consistent theming
- Fix layout rendering issues on multiple pages:
  * Calendar - Calendar View
  * Time Tracking - Projects, Weekly Goals, Time Entry Templates
  * Tools & Data - Import/Export, Saved Filters
  * Admin - Security Access (API Tokens), System Maintenance (Backups)
  * User pages (Profile, Settings)
  * Invoice, Quote, and Expense pages
  * All component widgets and help pages
- Remove footer section from base.html to clean up page layout
- Remove unused footer script for setting current year
- Ensure consistent card styling across entire application for proper dark mode support

Affects 33 template files total.
2025-12-30 20:41:58 +01:00
Dries Peeters 22bd7da213 Merge pull request #370 from DRYTRIX/rc/v4.8.3
Rc/v4.8.3
v4.8.3
2025-12-30 09:53:09 +01:00
Dries Peeters d4ee8fe4a3 version bump to 4.8.3 2025-12-30 09:52:31 +01:00
Dries Peeters 9507a9492c feat: Add comprehensive donation system with smart prompts and improved accessibility
- Add dedicated donation page (/donate) explaining why donations matter
- Implement DonationInteraction model to track user engagement and interactions
- Add smart banner logic with contextual messaging based on user milestones
- Improve donation accessibility with links in sidebar, footer, dashboard, and all major pages
- Add UTM tracking to all Buy Me a Coffee links for analytics
- Fix CSRF token issues in donation tracking JavaScript
- Enhance dashboard widget with user stats and dual action buttons
- Add donation information section to About page
- Update support banner with 'Learn More' and 'Donate' options
- Create database migration for donation_interactions table

The donation system now provides:
- Smart prompts that show after user milestones (7+ days, 50+ entries, 100+ hours)
- Banner dismissal tracking with 30-day cooldown
- Multiple access points throughout the application
- Better visibility of donation impact and importance
- Comprehensive tracking for analytics and optimization
2025-12-30 09:52:12 +01:00
Dries Peeters d6351eb1c2 Merge pull request #369 from DRYTRIX/rc/v4.8.2
Rc/v4.8.2
v4.8.2
2025-12-29 20:38:09 +01:00
Dries Peeters e21a350ec6 version bump 2025-12-29 20:36:18 +01:00
Dries Peeters 66ca9589bb Fix project template tasks creation and editing
- Fix tasks not being created when projects are created from templates
  * Remove invalid status parameter from task creation (TaskService doesn't accept it)
  * Fix estimated_hours conversion from string to float/None
  * Add proper error handling for task creation failures
  * Refresh template from database before reading tasks

- Fix missing tasks section in template edit form
  * Add tasks section to edit template form with full CRUD functionality
  * Display existing tasks when editing templates
  * Allow adding, editing, and removing tasks in templates

- Fix tasks not being saved when creating/editing templates
  * Fix JavaScript form handling to properly collect tasks from form
  * Create tasks input field on page load and update on submit
  * Add capture phase event listener to ensure tasks are set before form submission
  * Ensure tasks are always saved as a list (never None)

- Fix [object Object] error in toast notifications
  * Add safeguards to ensure flash messages are always strings
  * Add object-to-string conversion in toast notification system

- Improve error handling and validation
  * Add validation to ensure tasks is always a list
  * Improve JSON parsing with better error handling
  * Add safeguards for flash message handling
2025-12-29 20:33:56 +01:00
Dries Peeters e8bf502153 Fix: Handle None values in stock item form fields
Convert None database values to empty strings in template to prevent 'None' text from appearing in form fields. This fixes an issue where users had to manually delete 'None' from URL and other optional fields before saving.

Updated fields: image_url, description, category, barcode, and notes to use 'or' filter for proper None handling.
2025-12-29 19:50:33 +01:00
Dries Peeters b22c7662f4 Merge pull request #367 from DRYTRIX/rc/v4.8.1
Rc/v4.8.1
v4.8.1
2025-12-29 17:03:14 +01:00
Dries Peeters 090344aa5d Fix JSON serialization error when editing stock items
Convert Supplier objects to dictionaries before passing to template to
prevent 'Object of type Supplier is not JSON serializable' error.

The template uses tojson filter to serialize suppliers for JavaScript,
but SQLAlchemy model objects are not directly JSON serializable. By
converting suppliers to dictionaries using to_dict() method before
rendering, the serialization now works correctly.

Fixes issue where editing stock items resulted in 500 server error.
Affects both new_stock_item and edit_stock_item routes.
2025-12-29 17:01:31 +01:00