Commit Graph

89 Commits

Author SHA1 Message Date
656af599bb Implement semester-based quarterly tracking system
- Update quarterly confirmation deadlines to semester-based schedule:
  - Q1: March 15 (covers Spring semester Q1+Q2)
  - Q2: June 15 (auto-approved when Q1 approved)
  - Q3: September 15 (covers Fall semester Q3+Q4)
  - Q4: December 15 (auto-approved when Q3 approved)

- Add auto-approval functionality:
  - Q1 approval automatically approves Q2 with same document status
  - Q3 approval automatically approves Q4 with same document status
  - New 'auto_geprueft' status with distinct badge UI

- Maintain quarterly payment cycle while simplifying document submissions
- Remove modal edit functionality, keep full-screen editor only
- Update copilot instructions documentation

Changes align with academic semester system where students submit
documents twice yearly instead of quarterly.
2025-09-30 21:32:12 +02:00
ed6a02232e feat: Implement TOTP-based Two-Factor Authentication
- Add django-otp and qrcode dependencies
- Create comprehensive 2FA views and templates in German
- Add 2FA setup, verification, and management interfaces
- Implement backup token system with 10 recovery codes
- Add TwoFactorMiddleware for session enforcement
- Integrate 2FA controls into user navigation menu
- Support QR code generation for authenticator apps
- Add forms for secure 2FA operations with validation
- Configure OTP settings and admin site integration

Features:
- Optional 2FA (users can enable/disable)
- TOTP compatible with Google Authenticator, Authy, etc.
- Backup codes for emergency access
- German language interface
- Session-based 2FA enforcement
- Password confirmation for sensitive operations
- Production-ready with HTTPS support
2025-09-30 00:10:02 +02:00
92b689f5e7 Fix User DoesNotExist error in backup_cancel by using created_by_id
🐛 Root Cause Found & Fixed:
- Error occurred when accessing backup_job.created_by where the referenced user was deleted
- Django was trying to fetch a User object that no longer exists
- Changed to use backup_job.created_by_id instead of backup_job.created_by
- This avoids the foreign key lookup that was causing the 'User matching query does not exist' error

 Backup cancellation now works even when:
- Original creator user has been deleted from the database
- Foreign key relationship is broken but ID is still stored

The backup job can now be cancelled without triggering user lookup errors.
2025-09-29 22:14:06 +02:00
c46c3543b1 Add detailed debugging to backup_cancel function
🐛 Debug Enhancement:
- Added extensive print statements to track execution flow
- Identify exact location where 'User matching query does not exist' occurs
- Added traceback logging for better error diagnosis
- Isolated potential problem areas: user access, model saves, audit logging

This will help pinpoint where the user query error happens during backup cancellation.
2025-09-29 20:42:54 +02:00
33888a3b18 Fix backup cancellation user reference issues
🐛 Enhanced Error Handling:
- Fixed 'User matching query does not exist' error in backup_cancel
- Handle case where backup_job.created_by is None (deleted user)
- Added error handling for audit logging to prevent cancellation failure
- Improved permission check to handle null created_by references

 Backup Cancellation Robustness:
- Now works even if the user who created the backup was deleted
- Audit logging failure won't prevent successful cancellation
- Better error isolation and reporting

The error occurred because the system tried to compare a null user reference
or failed during audit logging when user records were inconsistent.
2025-09-29 20:40:51 +02:00
bdcede9a74 Fix BackupJob import error in backup_cancel function
🐛 Error Fixed:
- NameError: name 'BackupJob' is not defined in backup_cancel view
- Added missing 'from stiftung.models import BackupJob' import

 Backup cancellation now works correctly
- Users can cancel long-running backup jobs without errors
- Added local import following the same pattern as other backup functions

The error occurred when trying to cancel a running backup job due to missing model import.
2025-09-29 20:36:52 +02:00
a1ecd31b76 Enhance destinataer list: 50 entries per page + default sort by last name
🎯 Improvements Made:
- Increased pagination from 20 to 50 entries per page
- Added default sorting by last name (nachname) in ascending order
- Added visual sorting indicators with Font Awesome icons (up/down arrows)
- Added results info showing current page range and total count
- Display shows sorting method when active

📊 User Experience:
- List now shows 50 destinataers by default (as requested)
- Always sorted by last name for consistent browsing
- Clear visual feedback for which column is sorted
- Informative pagination showing 'X-Y of Z entries (50 per page)'

 Template & View Changes:
- Modified destinataer_list view in views.py
- Enhanced destinataer_list.html template
- Maintained all existing filtering and search functionality
2025-09-29 20:34:30 +02:00
0d672477af Fix VierteljahresNachweis export error - correct method name
🐛 Error Fixed:
- AttributeError: 'VierteljahresNachweis' object has no attribute 'completion_percentage'
- Line 5347 in destinataer_export view was calling completion_percentage()
- Corrected to call get_completion_percentage() which is the actual method name

 Export functionality now works correctly for destinataers with quarterly confirmations

The error occurred when exporting a destinataer that had quarterly tracking data.
All quarterly confirmation completion percentages are now properly exported.
2025-09-28 21:25:15 +02:00
994eb789b7 Fix quarterly tracking visibility and prevent duplicate support payments
🎯 Key Changes:
- Quarterly tracking now always visible (removed studiennachweis_erforderlich condition)
- Removed automatic support payment creation when 'Unterstützung bestätigt' checkbox is checked
- Support payments now ONLY created through quarterly confirmation approval workflow
- Updated auto-creation logic to create quarterly confirmations for ALL destinataers
- Updated 'no quarterly confirmations' message to be more user-friendly

🚫 Duplicate Prevention:
- No more duplicate destinataer entries in Unterstützungen list
- Single source of truth: quarterly confirmation system controls support payment creation

📋 Template Analysis:
- Reviewed all if/else statements in quarterly tracking section
- Kept all functional logic (status checks, file existence, permissions)
- Removed only the visibility-controlling conditions

 Result:
- Quarterly tracking always visible regardless of study proof requirements
- Clean separation between 'Unterstützung bestätigt' checkbox and support payment creation
- Eliminates the duplicate destinataer issue reported by user
2025-09-28 19:52:03 +02:00
remmerinio
4752735357 Delete app/media.backup.20250924_232119 directory 2025-09-28 19:12:20 +02:00
acac8695fd Enhanced quarterly confirmation system with approval workflow and export improvements
Features added:
-  Fixed quarterly confirmation approval system with URL pattern
-  Added re-approval and status reset functionality for quarterly confirmations
-  Synchronized quarterly approval status with support payment system
-  Enhanced Destinataer export with missing fields (anrede, titel, mobil)
-  Added quarterly confirmation data and documents to export system
-  Fixed address field display issues in destinataer template
-  Added quarterly statistics dashboard to support payment lists
-  Implemented duplicate support payment prevention and cleanup
-  Added visual indicators for quarterly-linked support payments

Technical improvements:
- Enhanced create_quarterly_support_payment() with duplicate detection
- Added get_related_support_payment() method to VierteljahresNachweis model
- Improved quarterly confirmation workflow with proper status transitions
- Added computed address property to Destinataer model
- Fixed template field mismatches (anrede, titel, mobil vs strasse, plz, ort)
- Enhanced backup system with operation tracking and cancellation

Workflow enhancements:
- Quarterly confirmations now properly sync with support payments
- Single support payment per destinataer per quarter (no duplicates)
- Approval button works for both eingereicht and geprueft status
- Reset functionality allows workflow restart
- Export includes complete quarterly data with uploaded documents
2025-09-28 19:09:08 +02:00
b00cf62d87 Add IBAN and Verwendungszweck columns to support list and fix chart growing bug
- Enhanced 'Alle Unterstützungen' view with IBAN and Verwendungszweck columns for better payment tracking
- Updated export functions to handle both legacy 'selected_fields' and new 'fields' parameters
- Added IBAN and Verwendungszweck to default export field selections
- Improved destinataer list UI by adding Status column and removing obsolete study proof field
- Fixed infinite growing animation bug in 'Größen der Grundstücke (Top 30)' chart by replacing Chart.js with CSS-based implementation
- Removed Bootstrap h-100 class conflicts that caused chart resize loops
2025-09-24 22:13:27 +02:00
d3ed13dda0 fix: Simplify deployment to build from source instead of using pre-built images
- Remove complex GHCR image pulling logic that was causing deployment failures
- Always build containers from source code on production server
- Remove unused build job that pushes to container registry
- Use docker-compose up -d --build to ensure latest code is built and deployed
- This ensures all new features like quarterly confirmations are available in production
2025-09-24 00:13:54 +02:00
126f68ec68 feat: Implement quarterly confirmation system with automatic support payments
- Add VierteljahresNachweis model for quarterly document tracking
- Remove studiennachweis_erforderlich field (now always required)
- Fix modal edit view to include studiennachweis section
- Implement automatic DestinataerUnterstuetzung creation when requirements met
- Set payment due dates to exact quarter end dates (Mar 31, Jun 30, Sep 30, Dec 31)
- Add quarterly confirmation CRUD views with modal and full-screen editing
- Update templates with comprehensive quarterly management interface
- Include proper validation, status tracking, and progress indicators
2025-09-23 23:52:44 +02:00
Stiftung Development
0184982f8c Add production environment update instructions
- Created PRODUCTION_ENV_UPDATE.md with step-by-step fix for CookieError
- Provides SSH commands to add missing SESSION_COOKIE_NAME and CSRF_COOKIE_NAME
- Includes verification steps to confirm fix works
2025-09-21 22:55:37 +02:00
Stiftung Development
36c66a803c Fix cookie configuration and update destinataer workflow
- Fixed empty cookie name issue in production by improving fallback logic
- Changed 'Neue Förderung' to 'Neue Unterstützung' in destinataer detail page
- Updated icon from fa-gift to fa-heart for better UX
- Workflow now correctly uses unterstuetzung_create with destinataer pre-population

Resolves CookieError: Illegal key '' in production environment
2025-09-21 22:52:55 +02:00
Stiftung Development
6282d1a02f Implement session cookie isolation between Django apps
- Added configurable SESSION_COOKIE_NAME and CSRF_COOKIE_NAME to Django settings
- Main app now uses 'stiftung_sessionid' instead of default 'sessionid'
- Paperless continues using default 'sessionid' for separation
- All configuration centralized in .env files as requested
- Updated both development and production compose configurations
- Added session settings to env templates for easy deployment

This resolves the session conflict where logging into one app would
kick out sessions from the other app. Both applications now maintain
independent login sessions.
2025-09-21 22:44:31 +02:00
Stiftung Development
b8a6e99f07 Add German OCR support to Paperless-ngx
- Created custom Dockerfile extending official paperless-ngx image
- Added tesseract-ocr-deu package for German language OCR
- Set PAPERLESS_OCR_LANGUAGE=deu+eng environment variable
- Updated CI/CD pipeline to build and push custom paperless image
- Modified deployment script to pull paperless image from GHCR
- Tested locally: German (deu) language pack now available alongside English
2025-09-21 21:09:58 +02:00
Stiftung Development
34b30be0a6 Fix deployment pipeline: resolve git divergent branches and prevent paperless build issues
- Updated git pull strategy to use fetch + reset instead of pull to handle divergent branches
- Added docker system prune to clean up build artifacts
- Modified image pulling to separate web services from standard images
- Added --no-build flag to prevent accidental local builds
- Addresses production 502 errors from failed deployments
2025-09-21 20:52:41 +02:00
Stiftung Development
8c7a5173a8 Trigger production deployment: force redeploy working local code
- Local environment tested and working correctly
- All Destinataer improvements verified locally
- Trigger GitHub Actions to redeploy to production VPS
- Address 502 errors on production server
2025-09-21 20:26:16 +02:00
Stiftung Development
15c798a97b Update footer version to v2.1.4 - Enhanced Destinataer Management
- Bump version from v2.1.3 to v2.1.4
- Update status badge from 'Stabil' to 'Enhanced'
- Reflect recent improvements to Destinataer inline editing and CSV import
2025-09-21 20:12:32 +02:00
Stiftung Development
8854fc2619 Enhance Destinataer functionality: inline editing and improved list view
- Add inline edit mode to destinataer detail view with AJAX save/cancel
- Fix form validation by aligning select choices with model definitions
- Update Destinataer model to make familienzweig and berufsgruppe optional
- Fix StiftungsKonto integration in forms and views
- Redesign destinataer list view with new column layout:
  * Vorname, Nachname, E-Mail, Vierteljährlicher Betrag
  * Letzter Studiennachweis, Unterstützung bestätigt, Aktionen
- Improve form styling and user experience
- Add proper field validation and error handling
- Enhance UI with better badges, icons, and formattingv2_sortorderfixed_remmer
2025-09-20 00:14:26 +02:00
Stiftung Development
69128196ef Enhance Destinataer functionality: inline editing and improved list view
- Add inline edit mode to destinataer detail view with AJAX save/cancel
- Fix form validation by aligning select choices with model definitions
- Update Destinataer model to make familienzweig and berufsgruppe optional
- Fix StiftungsKonto integration in forms and views
- Redesign destinataer list view with new column layout:
  * Vorname, Nachname, E-Mail, Vierteljährlicher Betrag
  * Letzter Studiennachweis, Unterstützung bestätigt, Aktionen
- Improve form styling and user experience
- Add proper field validation and error handling
- Enhance UI with better badges, icons, and formatting
2025-09-19 23:52:26 +02:00
Stiftung Development
584e2b8554 Add inline edit functionality to destinataer detail view - Added toggle between view and edit modes while maintaining elegant card design - Implemented AJAX form submission for seamless saving - Added JavaScript functionality for edit/save/cancel operations - Enhanced user experience with keyboard shortcuts and notifications 2025-09-19 22:52:14 +02:00
Stiftung Development
27396e8f9e Standardize form layouts: all input fields positioned underneath labels
- Change all form templates from col-md-6 to col-12 layout
- Affects destinataer_form.html, paechter_form.html, and land_form.html
- Ensures consistent single-column layout across all entity forms
- All input fields now appear underneath their labels instead of side-by-side
- Improves form readability and user experience on all screen sizes
2025-09-19 14:00:06 +02:00
Stiftung Development
7744a18657 Fix and enhance CSV import templates
- Update Destinataer template: added 8 missing fields (ist_abkoemmling, haushaltsgroesse, monatliche_bezuege, vermoegen, unterstuetzung_bestaetigt, vierteljaehrlicher_betrag, studiennachweis_erforderlich, letzter_studiennachweis)
- Update Laendereien template: added 20 missing fields including property details, tenant info, contract terms, financial data, and tax information
- Fix JavaScript template download functionality: correct block name from extra_js to javascript
- Add comprehensive debugging and error handling for download process
- Improve CSV formatting with proper quoting for text fields containing spaces
- Add fallback download methods for better browser compatibility

All CSV templates now include complete field sets matching current model definitions.
2025-09-19 12:36:17 +02:00
Stiftung Development
1422daa57a Add back GRAMPSWEB_BASE_URL=/ahnenforschung for reverse proxy 2025-09-19 09:28:12 +02:00
Stiftung Development
3faf6f2be5 Remove GRAMPSWEB_BASE_URL to test direct access 2025-09-18 21:18:44 +02:00
Stiftung Development
b599c85f0e Fix Grampsweb Redis rate limiting configuration (STORAGE_URI not STORAGE_URL) 2025-09-18 17:23:01 +02:00
Stiftung Development
c9513edb76 Add SQLite backend for Grampsweb initialization 2025-09-18 17:01:55 +02:00
Stiftung Development
af7ca25b29 Add Grampsweb Redis and Celery configuration for reverse proxy support 2025-09-18 16:41:32 +02:00
Stiftung Development
45bb040bdd Add missing Grampsweb port mapping 8090:5000 2025-09-18 16:25:47 +02:00
Stiftung Development
82994504be Fix Grampsweb port mapping from 8090:80 to 8090:5000 2025-09-18 16:19:02 +02:00
Stiftung Development
82d4dad7ab Configure Gramps for reverse proxy access via /ahnenforschung
- Remove external port mapping for grampsweb service
- Add GRAMPSWEB_BASE_URL environment variable
- Gramps will be accessible via https://vhtv-stiftung.de/ahnenforschung/
- Requires Nginx reverse proxy configuration on VPS
2025-09-18 00:07:08 +02:00
Stiftung Development
b7be251739 Fix Paperless thumbnail URLs: Remove duplicate /paperless/ path
- get_paperless_thumbnail_url() was adding /paperless/ twice
- PAPERLESS_API_URL already includes /paperless/ prefix
- Now generates: base_url/api/documents/{id}/thumb/ instead of base_url/api/paperless/documents/{id}/thumb/
- Fixes thumbnail display functionality
2025-09-17 23:55:45 +02:00
Stiftung Development
ea84ad86e7 Fix Paperless document redirect: Remove duplicate /paperless/ path
- paperless_document_redirect was adding /paperless/ twice
- PAPERLESS_API_URL already includes /paperless/ path
- Now redirects to: base_url/documents/{id}/details/ instead of base_url/paperless/documents/{id}/details/
- Fixes 404 errors when clicking document links
2025-09-17 23:46:22 +02:00
Stiftung Development
0fbaf7abb2 URGENT: Fix production Paperless integration
- Remove hardcoded fallbacks from config.py (relied on old prod values)
- Add missing Paperless env vars to compose.yml for production
- Update compose.dev.yml with complete Paperless configuration
- Fixes 500 errors by ensuring all env vars are passed to containers

Required: VPS .env must have PAPERLESS_*_TAG_ID and PAPERLESS_*_TAG variables
2025-09-17 22:06:01 +02:00
Stiftung Development
002e649116 Environment-only configuration: Remove hardcoded tag IDs and fix Paperless redirect
- Remove hardcoded defaults from PAPERLESS_*_TAG_ID in settings.py
- Fix Paperless document redirect to include /paperless/ prefix and /details/ suffix
- Update footer to v2.1.3 with deer icon
- Requires PAPERLESS_DESTINATAERE_TAG_ID, PAPERLESS_LAND_TAG_ID, PAPERLESS_ADMIN_TAG_ID in environment
2025-09-17 21:33:37 +02:00
Stiftung Development
d62e5cacff Update footer to v2.1.2 with improved styling and stable badge 2025-09-17 20:12:49 +02:00
Stiftung Development
cbde96698b Fix deployment pipeline - use main compose.yml instead of deploy-production
- Remove reference to deploy-production/docker-compose.prod.yml (now archived)
- Use compose.yml directly as the production configuration
- This should fix the deployment script and enable proper image updates
2025-09-17 19:54:23 +02:00
Stiftung Development
ebb9a1f887 Test deployment pipeline - update footer version to v2.1.1 2025-09-17 19:24:03 +02:00
Stiftung Development
25406036ea Update Paperless tag IDs to match current Paperless configuration
- Destinatäre tag ID: 210  4
- Land/Pächter tag ID: 204  5
- Administration tag ID: 216  6
2025-09-17 14:16:03 +02:00
Stiftung Development
a6559daeb1 Clean up docker-compose configuration
- Archive deploy-production directory as deploy-production-archived (legacy)
- Add DOCKER_COMPOSE_README.md for documentation
- Main configuration now uses compose.yml with working Paperless integration
- Paperless API URL configured as https://vhtv-stiftung.de/paperless
2025-09-17 13:19:35 +02:00
Stiftung Development
bbe3208fc0 Use external Paperless URL to avoid Host header issues 2025-09-16 23:16:02 +02:00
Stiftung Development
1a869372b4 Fix Paperless API URL to include /paperless path prefix 2025-09-16 22:56:36 +02:00
Stiftung Development
0c97c01396 Fix Paperless integration: use internal Docker network URL (http://paperless:8000) + improved error handling 2025-09-16 16:29:07 +02:00
Stiftung Development
a39995ce89 Test deployment: Remove 'Jan Remmer Siebels' from footer - pipeline test #2 2025-09-16 16:13:22 +02:00
Stiftung Development
aa85c48db3 Test deployment: Add 'Jan Remmer Siebels' to footer 2025-09-16 10:03:39 +02:00
Stiftung Development
155bacec9f Fix GHCR authentication: add fallback to local build + improved error handling 2025-09-16 09:53:57 +02:00
Stiftung Development
833de4a0c4 Add production debugging script for future troubleshooting 2025-09-16 00:04:03 +02:00