diff --git a/attached_assets/Pasted-Administration-User-related-Environment-related-Registries-Logs-Notifications-Se-1756890409403_1756890409403.txt b/attached_assets/Pasted-Administration-User-related-Environment-related-Registries-Logs-Notifications-Se-1756890409403_1756890409403.txt new file mode 100644 index 0000000..52dcfa1 --- /dev/null +++ b/attached_assets/Pasted-Administration-User-related-Environment-related-Registries-Logs-Notifications-Se-1756890409403_1756890409403.txt @@ -0,0 +1,235 @@ +Administration + +User-related + + +Environment-related + +Registries + +Logs + +Notifications + +Settings + +New version available 2.33.1 +DismissSee what's new +Community Edition +2.27.6 LTS +Containers>logiflow-logiflow-1>Logs +Container logs + + +admin +Log viewer settings +Auto-refresh logs +Wrap lines +Display timestamps +Fetch +All logs +Search +Filter... +Lines +100 +Actions + + + + + code: '42703', + + detail: undefined, + + hint: undefined, + + position: '183', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_target.c', + + line: '1075', + + routine: 'checkInsertTargets' + +} + +❌ Erreur sauvegarde cache not found BL: error: column "is_reconciled" of relation "invoice_verification_cache" does not exist + + at /app/node_modules/pg-pool/index.js:45:11 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + + at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22 + + at async DatabaseStorage.createInvoiceVerificationCache (file:///app/dist/index.js:2193:27) + + at async InvoiceVerificationService.verifyInvoiceByBL (file:///app/dist/index.js:4947:15) + + at async file:///app/dist/index.js:6758:18 { + + length: 153, + + severity: 'ERROR', + + code: '42703', + + detail: undefined, + + hint: undefined, + + position: '183', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_target.c', + + line: '1075', + + routine: 'checkInsertTargets' + +} + +🔗 PRODUCTION: getOrder #58 found 1 associated deliveries + +✅ PRODUCTION: getDelivery #88 found associated order #58 with status: delivered + +POST /api/deliveries/88/verify-invoice 403 in 1919ms + +❌ Erreur création cache: error: column "is_reconciled" of relation "invoice_verification_cache" does not exist + + at /app/node_modules/pg-pool/index.js:45:11 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + + at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22 + + at async DatabaseStorage.createInvoiceVerificationCache (file:///app/dist/index.js:2193:27) + + at async InvoiceVerificationService.verifyInvoiceByBL (file:///app/dist/index.js:4947:15) + + at async file:///app/dist/index.js:6758:18 { + + length: 153, + + severity: 'ERROR', + + code: '42703', + + detail: undefined, + + hint: undefined, + + position: '183', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_target.c', + + line: '1075', + + routine: 'checkInsertTargets' + +} + +❌ Erreur sauvegarde cache not found BL: error: column "is_reconciled" of relation "invoice_verification_cache" does not exist + + at /app/node_modules/pg-pool/index.js:45:11 + + at process.processTicksAndRejections (node:internal/process/task_queues:95:5) + + at async file:///app/node_modules/drizzle-orm/node-postgres/session.js:83:22 + + at async DatabaseStorage.createInvoiceVerificationCache (file:///app/dist/index.js:2193:27) + + at async InvoiceVerificationService.verifyInvoiceByBL (file:///app/dist/index.js:4947:15) + + at async file:///app/dist/index.js:6758:18 { + + length: 153, + + severity: 'ERROR', + + code: '42703', + + detail: undefined, + + hint: undefined, + + position: '183', + + internalPosition: undefined, + + internalQuery: undefined, + + where: undefined, + + schema: undefined, + + table: undefined, + + column: undefined, + + dataType: undefined, + + constraint: undefined, + + file: 'parse_target.c', + + line: '1075', + + routine: 'checkInsertTargets' + +} + +✅ Résultat vérification: { + + exists: false, + + matchType: 'none', + + errorMessage: 'Aucun BL correspondant trouvé dans NocoDB' + diff --git a/attached_assets/{6268739F-12F1-447E-8021-8D7A6666FC16}_1756890005406.png b/attached_assets/{6268739F-12F1-447E-8021-8D7A6666FC16}_1756890005406.png new file mode 100644 index 0000000..371431b Binary files /dev/null and b/attached_assets/{6268739F-12F1-447E-8021-8D7A6666FC16}_1756890005406.png differ diff --git a/attached_assets/{8C9A60B2-DD64-429F-B9FF-7B9F1598B3D8}_1756890188902.png b/attached_assets/{8C9A60B2-DD64-429F-B9FF-7B9F1598B3D8}_1756890188902.png new file mode 100644 index 0000000..094711b Binary files /dev/null and b/attached_assets/{8C9A60B2-DD64-429F-B9FF-7B9F1598B3D8}_1756890188902.png differ diff --git a/client/src/pages/BLReconciliation.tsx b/client/src/pages/BLReconciliation.tsx index 146fdc4..28dd665 100644 --- a/client/src/pages/BLReconciliation.tsx +++ b/client/src/pages/BLReconciliation.tsx @@ -213,7 +213,7 @@ export default function BLReconciliation() { queryKey: ['/api/deliveries/bl', selectedStoreId], queryFn: async () => { const params = new URLSearchParams({}); - if (selectedStoreId && user?.role === 'admin') { + if (selectedStoreId && (user?.role === 'admin' || user?.role === 'directeur')) { params.append('storeId', selectedStoreId.toString()); } diff --git a/server/routes.ts b/server/routes.ts index 2d8ac6c..b47f22d 100644 --- a/server/routes.ts +++ b/server/routes.ts @@ -80,28 +80,12 @@ export async function registerRoutes(app: Express): Promise { return res.status(404).json({ message: "User not found" }); } - console.log('🔍 [DEBUG] Groups request:', { - userId, - userRole: user.role, - userGroupsCount: (user as any).userGroups?.length || 0, - userGroups: (user as any).userGroups?.map((ug: any) => ({ - groupId: ug.groupId, - groupName: ug.group?.name - })) || [] - }); - // Only admin sees all groups, all other roles (manager, employee, directeur) see only their assigned groups if (user.role === 'admin') { const groups = await storage.getGroups(); - console.log('🔍 [DEBUG] Admin - returning all groups:', groups.length); res.json(groups); } else { const userGroups = (user as any).userGroups?.map((ug: any) => ug.group).filter(Boolean) || []; - console.log('🔍 [DEBUG] Non-admin - returning filtered groups:', { - role: user.role, - filteredGroupsCount: userGroups.length, - groups: userGroups.map((g: any) => ({ id: g.id, name: g.name })) - }); res.json(userGroups); } } catch (error) { @@ -694,15 +678,15 @@ export async function registerRoutes(app: Express): Promise { console.log('Deliveries API called with:', { startDate, endDate, storeId, withBL, userRole: user.role }); - if (user.role === 'admin' || user.role === 'directeur') { + if (user.role === 'admin') { let groupIds: number[] | undefined; - // If admin/directeur selected a specific store, filter by it + // If admin selected a specific store, filter by it if (storeId) { groupIds = [parseInt(storeId as string)]; - console.log('🔍 Admin/Directeur deliveries filtering by store:', { storeId, groupIds, role: user.role }); + console.log('🔍 Admin deliveries filtering by store:', { storeId, groupIds, role: user.role }); } else { - console.log('🔍 Admin/Directeur deliveries - showing all stores', { role: user.role }); + console.log('🔍 Admin deliveries - showing all stores', { role: user.role }); } // Only filter by date if both startDate and endDate are provided @@ -1038,9 +1022,17 @@ export async function registerRoutes(app: Express): Promise { return res.status(403).json({ message: "Insufficient permissions" }); } - if (user.role !== 'admin') { + // Admin and directeur have access to all deliveries, others must be in the same group + if (user.role !== 'admin' && user.role !== 'directeur') { const userGroupIds = user.userGroups?.map((ug: any) => ug.groupId) || []; if (!userGroupIds.includes(delivery.groupId)) { + console.log('🚫 Access denied - User groups check:', { + userId: user.id, + userRole: user.role, + userGroupIds, + deliveryGroupId: delivery.groupId, + deliverySupplier: delivery.supplier?.name + }); return res.status(403).json({ message: "Access denied to this group" }); } }