diff --git a/attached_assets/Pasted-ns-updatedAt-2025-07-25T23-07-17-197Z-Configuration-NocoDB-trouv-e--1755448270468_1755448270469.txt b/attached_assets/Pasted-ns-updatedAt-2025-07-25T23-07-17-197Z-Configuration-NocoDB-trouv-e--1755448270468_1755448270469.txt new file mode 100644 index 0000000..4b29799 --- /dev/null +++ b/attached_assets/Pasted-ns-updatedAt-2025-07-25T23-07-17-197Z-Configuration-NocoDB-trouv-e--1755448270468_1755448270469.txt @@ -0,0 +1,205 @@ +ns + + + + + updatedAt: 2025-07-25T23:07:17.197Z + +} + +🔧 Configuration NocoDB trouvée: { + + configName: 'Nocodb', + + baseUrl: 'https://nocodb.ffnancy.fr', + + projectId: 'pcg4uw79ukvycxc', + + hasToken: true + +} + +🔧 Utilisation table ID: { + + groupTable: 'CommandeH', + + configuredId: 'my7zunxprumahmm', + + resolvedId: 'my7zunxprumahmm' + +} + +🔍 Recherche NocoDB: { tableId: 'my7zunxprumahmm', column: 'RefFacture' } + +🔧 Configuration NocoDB active récupérée: { + + id: 1, + + name: 'Nocodb', + + baseUrl: 'https://nocodb.ffnancy.fr', + + projectId: 'pcg4uw79ukvycxc', + + apiToken: 'z4BAwLo6dgoN_E7PKJSHN7PA7kdBePtKOYcsDlwQ', + + description: '', + + isActive: true, + + createdBy: 'admin_local', + + createdAt: 2025-07-22T11:12:54.971Z, + + updatedAt: 2025-07-25T23:07:17.197Z + +} + +🔧 Configuration NocoDB trouvée: { + + configName: 'Nocodb', + + baseUrl: 'https://nocodb.ffnancy.fr', + + projectId: 'pcg4uw79ukvycxc', + + hasToken: true + +} + +🔧 Utilisation table ID: { + + groupTable: 'CommandeF', + + configuredId: 'mrr733dfb8wtt9b', + + resolvedId: 'mrr733dfb8wtt9b' + +} + +🔍 Recherche NocoDB: { tableId: 'mrr733dfb8wtt9b', column: 'RefFacture' } + +✅ [CACHE] Résultat sauvé en cache: { + + + +, + + invoiceReference: '25070526', + + groupId: 1, + + exists: true, + + cacheKey: '1_25070526' + +} + +✅ Résultat vérification: { + + exists: true, + + matchType: 'invoice_reference', + + invoiceReference: '25070526', + + invoiceAmount: 920.5, + + supplierName: "Cotillon d'Alasce" + +} + +✅ [CACHE] Résultat sauvé en cache: { + + id: 16638, + + invoiceReference: 'F5175811', + + groupId: 1, + + exists: true, + + cacheKey: '1_f5175811' + +} + +✅ Résultat vérification: { + + exists: true, + + matchType: 'invoice_reference', + + invoiceReference: 'F5175811', + + invoiceAmount: 2812.57, + + supplierName: 'JJA Atmosphera' + +} + +POST /api/deliveries/61/verify-invoice 200 in 2015ms + +POST /api/deliveries/89/verify-invoice 200 in 1989ms + +🔍 [CACHE] Résultat cache: { + + found: true, + + expired: true, + + expiresAt: 2025-08-14T16:04:19.769Z, + + currentTime: '2025-08-17T16:31:06.169Z' + +} + +⏰ [CACHE] Cache expiré pour: { invoiceReference: '25080486', groupId: 1 } + +🔍 [INVOICE] Pas de cache, requête API... + +🔧 Configuration NocoDB active récupérée: { + + id: 1, + + name: 'Nocodb', + + baseUrl: 'https://nocodb.ffnancy.fr', + + projectId: 'pcg4uw79ukvycxc', + + apiToken: 'z4BAwLo6dgoN_E7PKJSHN7PA7kdBePtKOYcsDlwQ', + + description: '', + + isActive: true, + + createdBy: 'admin_local', + + createdAt: 2025-07-22T11:12:54.971Z, + + updatedAt: 2025-07-25T23:07:17.197Z + +} + +🔧 Configuration NocoDB trouvée: { + + configName: 'Nocodb', + + baseUrl: 'https://nocodb.ffnancy.fr', + + projectId: 'pcg4uw79ukvycxc', + + hasToken: true + +} + +🔧 Utilisation table ID: { + + groupTable: 'CommandeF', + + configuredId: 'mrr733dfb8wtt9b', + + resolvedId: 'mrr733dfb8wtt9b' + +} + diff --git a/attached_assets/image_1755447820094.png b/attached_assets/image_1755447820094.png new file mode 100644 index 0000000..1844585 Binary files /dev/null and b/attached_assets/image_1755447820094.png differ diff --git a/replit.md b/replit.md index cd6c8f6..559b684 100644 --- a/replit.md +++ b/replit.md @@ -32,7 +32,7 @@ The platform is built with a clear separation of concerns, utilizing a modern fu - **Weather Integration:** A comprehensive, modern weather interface displays detailed weather conditions sourced directly from the Visual Crossing API with French language support. Features intelligent date comparison using the same day of the week from the previous year for more relevant weather pattern analysis (e.g., Friday August 15, 2025 vs Friday August 16, 2024). Enhanced with automatic geolocation detection moved to weather settings utility page for better UX organization. Fixed critical production error by removing unused toast dependencies from weather widget (August 2025). - **Order and Delivery Management:** Full CRUD operations for orders and deliveries, including linking orders to deliveries and managing their statuses. - **Reconciliation:** Functionality for reconciling Bills of Lading (BL) and invoices with immediate UI updates. -- **Invoice Verification Cache:** Robust caching system for invoice verification results with automatic expiration and conflict resolution. Enhanced with unique constraint handling and graceful error management for production stability (August 2025). Fixed production SSL certificate errors and fetch timeout loops with enhanced error handling, network timeout protection, and error result caching to prevent infinite retry loops (August 2025). **MAJOR BUG FIX (August 2025)**: Resolved critical cache system failure - MemStorage was returning `undefined` for all cache lookups, preventing cache functionality entirely. Implemented working in-memory cache with Map-based storage and expiration logic. Fixed development mode to properly save verification results to cache. Added comprehensive cache operation logging for debugging. Verified complete cache workflow: miss → save → hit cycle working perfectly. +- **Invoice Verification Cache:** Robust caching system for invoice verification results with automatic expiration and conflict resolution. Enhanced with unique constraint handling and graceful error management for production stability (August 2025). Fixed production SSL certificate errors and fetch timeout loops with enhanced error handling, network timeout protection, and error result caching to prevent infinite retry loops (August 2025). **MAJOR BUG FIX (August 2025)**: Resolved critical cache system failure - MemStorage was returning `undefined` for all cache lookups, preventing cache functionality entirely. Implemented working in-memory cache with Map-based storage and expiration logic. Fixed development mode to properly save verification results to cache. Added comprehensive cache operation logging for debugging. Verified complete cache workflow: miss → save → hit cycle working perfectly. **CRITICAL PRODUCTION FIX (August 2025)**: Fixed DatabaseStorage cache expiration bug - production was returning expired cache entries instead of checking expiration dates, causing repeated API calls despite existing cache. Added proper expiration verification and automatic cleanup of expired cache entries in PostgreSQL, matching MemStorage behavior. - **UI Scrollbar Optimization:** Eliminated redundant vertical scrollbar on the right side of the screen while preserving necessary internal page scrolling. Implemented global CSS rules with `overflow: hidden` on html/body/root and Layout height management to prevent vertical overflow issues in production (August 2025). - **Task Management:** Système complet de gestion des tâches avec fonctionnalités temporelles avancées - tri intelligent (pending > priorité > date), dates d'échéance avec sélecteur calendrier, indicateurs visuels pour tâches en retard/urgentes, filtres par échéance (aujourd'hui, cette semaine, en retard, sans échéance), vue Kanban et liste, badges colorés pour statut temporel. Interface optimisée pour suivi prioritaire des tâches non validées. Correction critique de l'isolation des données : chaque magasin ne voit maintenant que ses propres tâches (Août 2025). **PRODUCTION FIX (Août 2025)** : Résolution du problème de rechargements multiples nécessaires pour l'administrateur - le cache des tâches s'invalide maintenant automatiquement lors du changement de magasin sélectionné. - **Information System (Announcements):** Système d'informations complet remplaçant la carte commandes clients dans le dashboard - gestion d'annonces avec niveaux de priorité (normal, important, urgent), contrôle d'accès basé sur les rôles (admin : CRUD complet, autres rôles : lecture seule), tri intelligent par priorité et date, filtrage par magasin pour administrateurs, interface moderne avec badges colorés et indicateurs visuels. **PRODUCTION FIX MAJEUR (Août 2025)** : Correction critique du problème d'affichage en production PostgreSQL - fix du filtrage pour inclure annonces globales + magasin sélectionné, correction des relations d'auteur avec username au lieu d'ID, design adapté pour correspondre exactement aux autres cartes du dashboard. **SUPPRESSION FIX (Août 2025)** : Correction du problème de suppression en production - ajout de la logique PostgreSQL manquante dans la route DELETE, les annonces peuvent maintenant être supprimées correctement en production. diff --git a/server/storage.ts b/server/storage.ts index fba8d01..d79b812 100644 --- a/server/storage.ts +++ b/server/storage.ts @@ -1298,7 +1298,33 @@ export class DatabaseStorage implements IStorage { .select() .from(invoiceVerificationCache) .where(eq(invoiceVerificationCache.cacheKey, cacheKey)); - return cache; + + // ✅ Vérification d'expiration ajoutée pour production + if (cache) { + const now = new Date(); + const expiresAt = new Date(cache.expiresAt); + + if (now < expiresAt) { + console.log('✅ [DATABASE-CACHE] Cache hit pour:', { + cacheKey, + expires: cache.expiresAt, + hoursRemaining: Math.round((expiresAt.getTime() - now.getTime()) / (1000 * 60 * 60)) + }); + return cache; // Cache valide + } else { + console.log('⏰ [DATABASE-CACHE] Cache expiré, suppression:', { + cacheKey, + expiredAt: cache.expiresAt + }); + // Supprimer le cache expiré + await db.delete(invoiceVerificationCache) + .where(eq(invoiceVerificationCache.cacheKey, cacheKey)); + return undefined; // Cache expiré + } + } + + console.log('❌ [DATABASE-CACHE] Cache miss pour:', { cacheKey }); + return undefined; // Pas de cache } async createInvoiceVerificationCache(cacheData: InsertInvoiceVerificationCache): Promise {