diff --git a/attached_assets/Pasted-s-CALLING-storage-getPublicities-filterYear-2025-groupIds-undefined--1757359090128_1757359090128.txt b/attached_assets/Pasted-s-CALLING-storage-getPublicities-filterYear-2025-groupIds-undefined--1757359090128_1757359090128.txt new file mode 100644 index 0000000..55d68ad --- /dev/null +++ b/attached_assets/Pasted-s-CALLING-storage-getPublicities-filterYear-2025-groupIds-undefined--1757359090128_1757359090128.txt @@ -0,0 +1,204 @@ +s + + + + +📋 CALLING storage.getPublicities: { filterYear: 2025, groupIds: undefined } + +GET /api/user 304 in 139ms + +📋 PUBLICITES FETCHED: 29 résultats pour année 2025 + +🔍 PREMIERS RESULTATS: [ + + '1. N°2501 - Blanc', + + '2. N°2502 - Moins de 1€ 2€ 3€ 4€ 5€', + + '3. N°2503 - Imbattables' + +] + +🔍 [PRODUCTION] Raw messages from DB: 2 items: [ + + { + + id: 16, + + title: 'Mise à jour Prix', + + content: 'Merci de mettre vos prix a jour tous les matins, certain magasin ne le font pas.', + + type: 'success', + + storeId: null, + + createdBy: 'admin', + + createdAt: 2025-08-18T10:45:08.585Z + + }, + + { + + id: 8, + + title: 'Bon de Livraison', + + content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.', + + type: 'info', + + storeId: null, + + createdBy: 'admin_local', + + createdAt: 2025-08-07T11:04:38.123Z + + } + +] + +🔍 [PRODUCTION] Looking for user with username: admin + +🔍 [PRODUCTION] Looking for user with username: admin_local + +📋 PUBLICITIES RETURNED: { count: 29 } + +GET /api/publicities 304 in 235ms + +🔍 [PRODUCTION] User search result: Found + +❌ [PRODUCTION] User not found with username: admin_local + +🔍 [PRODUCTION] User search result: Not found + +🎯 [PRODUCTION] Found announcements: 2 + +GET /api/announcements 304 in 136ms + +GET /api/user 304 in 4ms + +📢 [SERVER] Fetching announcements for user: admin_local environment: production + +Orders API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + userRole: 'admin' + +} + +🔍 Admin orders filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' } + +Fetching all orders + +Deliveries API called with: { + + startDate: undefined, + + endDate: undefined, + + storeId: '1', + + withBL: undefined, + + userRole: 'admin' + +} + +🔍 Admin deliveries filtering by store: { storeId: '1', groupIds: [ 1 ], role: 'admin' } + +Fetching all deliveries + +Customer Orders API called with: { groupIds: [ 1 ], userRole: 'admin' } + +📢 [SERVER] User found: { username: 'admin', role: 'admin' } + +🎯 [PRODUCTION] Using PostgreSQL DASHBOARD_MESSAGES table + +Customer Orders returned: 11 items + +GET /api/customer-orders 304 in 90ms + +🔗 PRODUCTION: getDeliveries() récupéré 82 livraisons avec relations + +Deliveries returned: 82 items + +GET /api/deliveries 304 in 170ms + +🔍 [PRODUCTION] Raw messages from DB: 2 items: [ + + { + + id: 16, + + title: 'Mise à jour Prix', + + content: 'Merci de mettre vos prix a jour tous les matins, certain magasin ne le font pas.', + + type: 'success', + + storeId: null, + + createdBy: 'admin', + + createdAt: 2025-08-18T10:45:08.585Z + + }, + + { + + id: 8, + + title: 'Bon de Livraison', + + content: 'Lorsque vous rentrez un numéro de bon de livraison, faite le a l identique, même les majuscules. Pour My candy Shop, prendre le numéro de commande.', + + type: 'info', + + storeId: null, + + createdBy: 'admin_local', + + createdAt: 2025-08-07T11:04:38.123Z + + } + +] + +🔍 [PRODUCTION] Looking for user with username: admin + +🔍 [PRODUCTION] Looking for user with username: admin_local + +🔍 [PRODUCTION] User search result: Not found + +❌ [PRODUCTION] User not found with username: admin_local + +🔍 [PRODUCTION] User search result: Found + +🎯 [PRODUCTION] Found announcements: 2 + +🔗 PRODUCTION: getOrders() récupéré 64 commandes avec relations + +Orders returned: 64 items + +GET /api/announcements 304 in 216ms + +GET /api/orders 304 in 221ms + +GET /api/groups 304 in 216ms + +GET /api/user 304 in 74ms + +GET /api/suppliers 304 in 6ms + +🔍 Avoirs API called with: { groupIds: [ 1 ], userRole: 'admin' } + +📋 Avoirs returned: 1 items + +GET /api/avoirs 304 in 9ms \ No newline at end of file diff --git a/attached_assets/image_1757359077252.png b/attached_assets/image_1757359077252.png new file mode 100644 index 0000000..46816ad Binary files /dev/null and b/attached_assets/image_1757359077252.png differ diff --git a/client/src/pages/Avoirs.tsx b/client/src/pages/Avoirs.tsx index 7eeb460..5770ea1 100644 --- a/client/src/pages/Avoirs.tsx +++ b/client/src/pages/Avoirs.tsx @@ -566,58 +566,8 @@ export default function Avoirs() { }); }; - // Charger les résultats de vérification depuis le cache au démarrage - useEffect(() => { - const loadVerificationResults = async () => { - if (!avoirs || avoirs.length === 0) return; - - const avoirsWithReferences = avoirs.filter(avoir => - avoir.invoiceReference?.trim() && - (avoir.group?.nocodbTableName || avoir.group?.nocodbConfigId) - ); - - if (avoirsWithReferences.length === 0) return; - - console.log(`🔍 Chargement des résultats de vérification pour ${avoirsWithReferences.length} avoirs`); - - // Charger les résultats depuis le cache en parallèle - const results = await Promise.allSettled( - avoirsWithReferences.map(async (avoir) => { - try { - const result = await apiRequest(`/api/avoirs/${avoir.id}/verify-invoice`, 'POST', { - invoiceReference: avoir.invoiceReference, - forceRefresh: false // Utiliser le cache si disponible - }); - return { avoirId: avoir.id, result }; - } catch (error) { - console.error(`Erreur chargement cache avoir ${avoir.id}:`, error); - return { - avoirId: avoir.id, - result: { - exists: false, - matchType: 'none', - errorMessage: 'Erreur de chargement' - } - }; - } - }) - ); - - // Appliquer les résultats chargés - const newResults: Record = {}; - results.forEach((result) => { - if (result.status === 'fulfilled') { - const { avoirId, result: verificationResult } = result.value; - newResults[avoirId] = verificationResult; - } - }); - - setAvoirVerificationResults(newResults); - console.log(`✅ Résultats de vérification chargés pour ${Object.keys(newResults).length} avoirs`); - }; - - loadVerificationResults(); - }, [avoirs]); // Se déclenche quand les avoirs sont chargés + // ✅ SUPPRIMÉ : Le chargement automatique causait des crashes JavaScript + // Les vérifications se font maintenant uniquement à la demande utilisateur // 🔥 FONCTIONS WEBHOOK MODAL (comme rapprochement) const handleFileChange = (event: React.ChangeEvent) => {