mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-20 21:49:07 +02:00
Merge pull request #129 from R0m1k3/1.1
Ensure order taker information is provided for customer orders
This commit is contained in:
4 files changed
+220
-8
No files matched your search
+204
@@ -0,0 +1,204 @@
|
|||||||
|
ctions
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
GET /api/user 401 in 2ms
|
||||||
|
|
||||||
|
GET /api/default-credentials-check 304 in 2ms
|
||||||
|
|
||||||
|
🔐 comparePasswords: {
|
||||||
|
|
||||||
|
supplied: 'HIDDEN',
|
||||||
|
|
||||||
|
stored: 'b23ec450a63faf3957a1...',
|
||||||
|
|
||||||
|
hasFormat: true
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔐 Password comparison result: true
|
||||||
|
|
||||||
|
POST /api/login 200 in 51ms
|
||||||
|
|
||||||
|
GET /api/user 200 in 5ms
|
||||||
|
|
||||||
|
GET /api/user 304 in 10ms
|
||||||
|
|
||||||
|
📊 Calcul statistiques mensuelles: {
|
||||||
|
|
||||||
|
year: 2025,
|
||||||
|
|
||||||
|
month: 8,
|
||||||
|
|
||||||
|
startDate: '2025-08-01',
|
||||||
|
|
||||||
|
endDate: '2025-09-01',
|
||||||
|
|
||||||
|
groupIds: [ 2 ]
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Orders API called with: {
|
||||||
|
|
||||||
|
startDate: undefined,
|
||||||
|
|
||||||
|
endDate: undefined,
|
||||||
|
|
||||||
|
storeId: undefined,
|
||||||
|
|
||||||
|
userRole: 'employee'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Non-admin filtering with groupIds: [ 2 ]
|
||||||
|
|
||||||
|
Deliveries API called with: {
|
||||||
|
|
||||||
|
startDate: undefined,
|
||||||
|
|
||||||
|
endDate: undefined,
|
||||||
|
|
||||||
|
storeId: undefined,
|
||||||
|
|
||||||
|
withBL: undefined,
|
||||||
|
|
||||||
|
userRole: 'employee'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Non-admin filtering deliveries with groupIds: [ 2 ]
|
||||||
|
|
||||||
|
📊 Statistiques calculées: {
|
||||||
|
|
||||||
|
ordersCount: 8,
|
||||||
|
|
||||||
|
deliveriesCount: 21,
|
||||||
|
|
||||||
|
pendingOrdersCount: 4,
|
||||||
|
|
||||||
|
averageDeliveryTime: 0.17647058823529413,
|
||||||
|
|
||||||
|
totalPalettes: 57,
|
||||||
|
|
||||||
|
totalPackages: 17
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔗 PRODUCTION: getOrders() récupéré 18 commandes avec relations
|
||||||
|
|
||||||
|
Orders returned: 18 items
|
||||||
|
|
||||||
|
Customer Orders API called with: { groupIds: [ 2 ], userRole: 'employee' }
|
||||||
|
|
||||||
|
GET /api/stats/monthly 200 in 76ms
|
||||||
|
|
||||||
|
GET /api/orders 200 in 76ms
|
||||||
|
|
||||||
|
Customer Orders returned: 25 items
|
||||||
|
|
||||||
|
GET /api/customer-orders 200 in 82ms
|
||||||
|
|
||||||
|
🔗 PRODUCTION: getDeliveries() récupéré 38 livraisons avec relations
|
||||||
|
|
||||||
|
Deliveries returned: 38 items
|
||||||
|
|
||||||
|
GET /api/deliveries 200 in 91ms
|
||||||
|
|
||||||
|
Tasks API called with: { groupIds: [ 2 ], userRole: 'employee' }
|
||||||
|
|
||||||
|
GET /api/publicities 304 in 92ms
|
||||||
|
|
||||||
|
GET /api/dlc-products/stats 200 in 93ms
|
||||||
|
|
||||||
|
Tasks returned: 9 items
|
||||||
|
|
||||||
|
GET /api/tasks 200 in 92ms
|
||||||
|
|
||||||
|
GET /api/user 304 in 23ms
|
||||||
|
|
||||||
|
GET /api/publicities 304 in 9ms
|
||||||
|
|
||||||
|
GET /api/user 304 in 4ms
|
||||||
|
|
||||||
|
GET /api/groups 200 in 5ms
|
||||||
|
|
||||||
|
GET /api/user 304 in 7ms
|
||||||
|
|
||||||
|
GET /api/suppliers 304 in 10ms
|
||||||
|
|
||||||
|
GET /api/user 304 in 7ms
|
||||||
|
|
||||||
|
🔍 CUSTOMER ORDER PERMISSION DEBUG: {
|
||||||
|
|
||||||
|
userRole: 'employee',
|
||||||
|
|
||||||
|
userId: '_1753266816257',
|
||||||
|
|
||||||
|
userGroups: [ { userId: '_1753266816257', groupId: 2, group: [Object] } ],
|
||||||
|
|
||||||
|
requestedGroupId: 2,
|
||||||
|
|
||||||
|
requestedGroupIdType: 'number'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
🔍 CUSTOMER ORDER - User group IDs: [ 2 ]
|
||||||
|
|
||||||
|
🔍 CUSTOMER ORDER - Requested group ID: 2
|
||||||
|
|
||||||
|
🔍 CUSTOMER ORDER - Converted group ID: 2
|
||||||
|
|
||||||
|
✅ CUSTOMER ORDER - Permission granted for user role: employee
|
||||||
|
|
||||||
|
Error creating customer order: error: null value in column "order_taker" of relation "customer_orders" violates not-null constraint
|
||||||
|
|
||||||
|
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.createCustomerOrder (file:///app/dist/index.js:1823:33)
|
||||||
|
|
||||||
|
at async file:///app/dist/index.js:5278:29 {
|
||||||
|
|
||||||
|
length: 395,
|
||||||
|
|
||||||
|
severity: 'ERROR',
|
||||||
|
|
||||||
|
code: '23502',
|
||||||
|
|
||||||
|
detail: 'Failing row contains (73, null, test, null, null, null, null, 366092323745, 1, 2, En attente de Commande, 0.00, f, f, null, 2, _1753266816257, 2025-08-14 11:55:42.977226, 2025-08-14 11:55:42.977226).',
|
||||||
|
|
||||||
|
hint: undefined,
|
||||||
|
|
||||||
|
position: undefined,
|
||||||
|
|
||||||
|
internalPosition: undefined,
|
||||||
|
|
||||||
|
internalQuery: undefined,
|
||||||
|
|
||||||
|
where: undefined,
|
||||||
|
|
||||||
|
schema: 'public',
|
||||||
|
|
||||||
|
table: 'customer_orders',
|
||||||
|
|
||||||
|
column: 'order_taker',
|
||||||
|
|
||||||
|
dataType: undefined,
|
||||||
|
|
||||||
|
constraint: undefined,
|
||||||
|
|
||||||
|
file: 'execMain.c',
|
||||||
|
|
||||||
|
line: '1972',
|
||||||
|
|
||||||
|
routine: 'ExecConstraints'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
POST /api/customer-orders 500 in 13ms
|
||||||
|
|
||||||
|
HEAD /api/health 200 in 0ms
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 276 KiB |
@@ -170,18 +170,21 @@ export function CustomerOrderForm({
|
|||||||
|
|
||||||
// Prepare final data with user's assigned group
|
// Prepare final data with user's assigned group
|
||||||
const submitData = {
|
const submitData = {
|
||||||
|
orderTaker: data.orderTaker || user?.firstName + ' ' + user?.lastName || user?.username || "Inconnu",
|
||||||
customerName: data.customerName.trim(),
|
customerName: data.customerName.trim(),
|
||||||
contactNumber: data.contactNumber || '',
|
customerPhone: data.contactNumber || '',
|
||||||
productName: data.productName || '',
|
customerEmail: data.customerEmail || '',
|
||||||
|
productDesignation: data.productName || '',
|
||||||
|
productReference: data.productReference || '',
|
||||||
|
gencode: data.gencode || '',
|
||||||
quantity: data.quantity,
|
quantity: data.quantity,
|
||||||
groupId: groupId, // Always use the assigned group
|
supplierId: data.supplierId || 1,
|
||||||
isPickup: false,
|
status: data.status || "En attente de Commande",
|
||||||
notes: data.notes,
|
|
||||||
deposit: data.deposit || 0,
|
deposit: data.deposit || 0,
|
||||||
isPromotionalPrice: data.isPromotionalPrice || false,
|
isPromotionalPrice: data.isPromotionalPrice || false,
|
||||||
customerEmail: data.customerEmail,
|
customerNotified: data.customerNotified || false,
|
||||||
gencode: data.gencode || '',
|
notes: data.notes || '',
|
||||||
supplierId: data.supplierId || 1,
|
groupId: groupId, // Always use the assigned group
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log("✅ Customer Order Submit FINAL:", {
|
console.log("✅ Customer Order Submit FINAL:", {
|
||||||
|
|||||||
@@ -1384,6 +1384,11 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
|||||||
createdBy: user.id,
|
createdBy: user.id,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// DEBUG: Log what we received and what we're about to save
|
||||||
|
console.log('🔍 CUSTOMER ORDER - Received data from frontend:', req.body);
|
||||||
|
console.log('🔍 CUSTOMER ORDER - Final data for DB:', data);
|
||||||
|
console.log('🔍 CUSTOMER ORDER - orderTaker value:', data.orderTaker, 'type:', typeof data.orderTaker);
|
||||||
|
|
||||||
// Check if user has access to the group - PRODUCTION DEBUG
|
// Check if user has access to the group - PRODUCTION DEBUG
|
||||||
console.log('🔍 CUSTOMER ORDER PERMISSION DEBUG:', {
|
console.log('🔍 CUSTOMER ORDER PERMISSION DEBUG:', {
|
||||||
userRole: user.role,
|
userRole: user.role,
|
||||||
|
|||||||
Reference in new issue
Block a user