mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-01-25 14:09:16 -06:00
Add comprehensive CSV import and export functionality for clients, supporting custom fields and multiple contacts per client. This enables bulk client management and integration with external ERP systems. Features: - CSV import for clients with support for: * All standard client fields (name, description, contact info, rates, etc.) * Custom fields via custom_field_<name> columns * Multiple contacts per client via contact_N_* columns (contact_1_first_name, etc.) * Duplicate detection by client name or custom field values * Option to skip duplicates during import - Enhanced CSV export for clients including: * All custom fields as separate columns * All contacts with full contact details (name, email, phone, title, role, etc.) * Dynamic column generation based on available custom fields and contact count - New API endpoints: * POST /api/import/csv/clients - Import clients from CSV * GET /api/import/template/csv/clients - Download CSV template - UI integration in Import/Export page: * Client import section with file upload and duplicate skip option * Client export button with direct download * Template download link * Improved error handling with detailed error messages Technical improvements: - Added import_csv_clients() function in app/utils/data_import.py - Enhanced export_clients() route to include custom fields and contacts - Fixed CSRF token handling for multipart/form-data requests - Added comprehensive error handling for non-JSON responses - Improved file encoding support (UTF-8 and Latin-1) Use case: Enables exporting all clients from TimeTracker, comparing with ERP system exports, removing duplicates, and importing the cleaned data back. Closes: Client import/export feature request