Commit Graph

33 Commits

Author SHA1 Message Date
Christian
8ac3a9db2f v1.3.64 - Redesigned sync architecture with clear field ownership
BREAKING CHANGES:
- vTiger sync: Never overwrites existing vtiger_id
- Contact sync: REPLACES links instead of appending (idempotent)
- E-conomic sync: Only updates fields it owns (address, city, postal, email_domain, website)
- E-conomic sync: Does NOT overwrite name or cvr_number anymore

ARCHITECTURE:
- Each data source owns specific fields
- Sync operations are now idempotent (can run multiple times)
- Clear documentation of field ownership in sync_router.py
- Contact links deleted and recreated on sync to match vTiger state

FIXED:
- Contact relationships now correct after re-sync
- No more mixed customer data from different sources
- Sorting contacts by company_count DESC (companies first)
2025-12-24 10:34:13 +01:00
Christian
a867a7f128 fix: sync address field from e-conomic (v1.3.63)
- Added address field to UPDATE query in economic sync
- Added address field to INSERT query for new customers
- Fixes issue where address from e-conomic was not synced
- Prevents mixed data (København address with Lundby city/postal)
- Address is now synced along with city, postal_code, country
2025-12-24 09:41:51 +01:00
Christian
c254e7cb76 feat: dynamic version from VERSION file (v1.3.57)
- Created VERSION file with current version
- Health endpoints now read version from VERSION file instead of hardcoded
- Fixes issue where health check showed wrong version
- main.py /health and /api/v1/system/health now show correct version
2025-12-23 15:32:34 +01:00
Christian
0833f149e1 fix: always sync economic_customer_number from e-conomic (v1.3.56)
- Fixed UPDATE query to include economic_customer_number field
- Previously only set on INSERT, not UPDATE when matching by CVR
- Now e-conomic customer number is always synced as source of truth
- Fixes issue where customers synced from e-conomic were missing customer numbers
2025-12-23 15:22:55 +01:00
Christian
e4b940009f Feature: Auto-create customers from vTiger accounts when linking contacts 2025-12-22 15:20:29 +01:00
Christian
e541758c44 Add: Sync diagnostics endpoint for troubleshooting contact linking 2025-12-22 15:14:31 +01:00
Christian
6d949d7060 Refactor: Komplet omskrivning af kontakt sync med simpel logik 2025-12-22 15:05:40 +01:00
Christian
0fb404dff5 Fix: Rettet indentation fejl i kontakt linking kode 2025-12-22 14:41:44 +01:00
Christian
0b8a4ff5d0 Debug: Rettet debug logging counter for kontakter 2025-12-22 14:36:55 +01:00
Christian
82ecfda404 Debug: Tilføjet logging af account_id værdier for kontakter 2025-12-22 14:34:07 +01:00
Christian
6398a7ca5f Debug: Ændret logging level for kontakt linking fejl (debug → info) 2025-12-22 14:25:41 +01:00
Christian
ddcf64ae78 Fix: Tjek for duplicate vtiger_id før update (undgår constraint violation) 2025-12-22 14:15:17 +01:00
Christian
0b6d286332 Debug: Tilføjet bedre logging til vTiger matching for at identificere problem 2025-12-22 14:13:44 +01:00
Christian
64935b5808 Fix: Tilføjet pagination til kontakter + forbedret relation linking 2025-12-22 13:24:41 +01:00
Christian
62fc3cb4dd Fix: Check for existing customer by CVR også (undgå duplicate key error) 2025-12-22 13:18:36 +01:00
Christian
198c6c56f4 Fix: Truncate country code til max 2 chars (ISO format) 2025-12-22 13:17:03 +01:00
Christian
a9f5714662 Feature: Omstruktureret sync - e-conomic er nu primær kilde, vTiger linker bagefter 2025-12-22 13:02:24 +01:00
Christian
e5dc0f64d3 Fix: Rettet vTiger pagination - bruger ID-baseret filtering i stedet for LIMIT OFFSET 2025-12-22 12:59:12 +01:00
Christian
94781227b2 Fix: Implementeret pagination i vTiger sync for at hente ALLE kunder (batch size 200) 2025-12-22 12:53:11 +01:00
Christian
187b72238d Fix: Fjernet LIMIT fra vTiger sync for at hente ALLE kunder og kontakter 2025-12-22 11:39:07 +01:00
Christian
41f7ae991c Fix: Rettet test-economic endpoint - fjernet ikke-eksisterende get_self() kald 2025-12-22 11:17:36 +01:00
Christian
7fd596612c Feature: Tilføjet /api/v1/system/test-economic endpoint til at teste e-conomic API forbindelse 2025-12-22 11:15:16 +01:00
Christian
c5ce819a15 Fix: Rettet typo i e-conomic sync (verifiot_matched_count → verified_count) og tilføjet not_matched til return value 2025-12-22 10:48:04 +01:00
Christian
8b71524437 Add verified count to e-conomic sync (separate new matches from existing verifications) 2025-12-19 16:56:39 +01:00
Christian
030071e8d5 Improve e-conomic sync: Only match new customers, verify existing ones 2025-12-19 16:54:57 +01:00
Christian
5d8617bed3 Fix: Add pagination for e-conomic customers (max 1000 per page) 2025-12-19 16:53:39 +01:00
Christian
c9af509e1c Implement e-conomic customer sync and CVR search (get_customers + search_customer_by_cvr) 2025-12-19 16:41:11 +01:00
Christian
55478c20d3 Add detailed sync logging with precise changes (oprettet/opdateret/linket med firma/CVR info) 2025-12-19 16:36:41 +01:00
Christian
3f66bd07e6 Fix: Remove WHERE clauses and cf_854 field from vTiger queries (API doesn't support empty string comparison) 2025-12-19 15:34:49 +01:00
Christian
8bc633d59c Fix: Convert vTiger SQL queries to single-line (API requires no line breaks) 2025-12-19 15:28:25 +01:00
Christian
7c69cb22e7 Feature: Add sync page to settings
- Add Sync navigation tab in settings
- Sync UI with status cards (total, vTiger, e-conomic)
- Action cards for vTiger and e-conomic sync
- Sync log with real-time updates
- JavaScript functions for sync operations
- Backend sync router with vTiger account sync
- Backend vTiger contacts sync with customer linking
- Placeholder for e-conomic sync (needs get_customers method)
- Name normalization for company matching
- CVR number matching and validation
2025-12-19 13:09:42 +01:00
Christian
0502a7b080 feat: Implement central tagging system with CRUD operations, entity tagging, and workflow management
- Added API endpoints for tag management (create, read, update, delete).
- Implemented entity tagging functionality to associate tags with various entities.
- Created workflow management for tag-triggered actions.
- Developed frontend views for tag administration using FastAPI and Jinja2.
- Designed HTML template for tag management interface with Bootstrap styling.
- Added JavaScript for tag picker component with keyboard shortcuts and dynamic tag filtering.
- Created database migration scripts for tags, entity_tags, and tag_workflows tables.
- Included default tags for initial setup in the database.
2025-12-17 07:56:33 +01:00
Christian
050e886f22 Add Material Blue design templates for dashboard and customer overview pages 2025-12-06 02:22:01 +01:00