Merge pull request #330 from R0m1k3/1.1

1.1
This commit is contained in:
LogiFlow authored and GitHub committed 2025-09-03 11:13:53 +02:00
commit 3dec85a415
5 files changed
+249 -22

No files matched your search

@@ -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'
Binary file not shown.

After

Width:  |  Height:  |  Size: 259 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

+1 -1
View File
@@ -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());
}
+13 -21
View File
@@ -80,28 +80,12 @@ export async function registerRoutes(app: Express): Promise<Server> {
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<Server> {
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<Server> {
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" });
}
}