mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Fix customer order creation to use the correct store group
Remove overridden group ID logic in CustomerOrderForm.tsx to correctly use defaultValues, resolving an issue where employees assigned to store #2 were creating orders for store #1. Replit-Commit-Author: Agent Replit-Commit-Session-Id: b163d4c0-de5e-4f4e-a9c0-aed4c7049718 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/b163d4c0-de5e-4f4e-a9c0-aed4c7049718/yNU6s0F
This commit is contained in:
1 parent
311286646f
commit
8c35e8e32f
3 files changed
+3
-25
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 151 KiB |
@@ -135,30 +135,8 @@ export function CustomerOrderForm({
|
||||
fullUserObject: user
|
||||
});
|
||||
|
||||
// FORCE L'UTILISATION DU GROUPE ASSIGNÉ EN PREMIER - MÊME LOGIQUE QUE DLC
|
||||
if (!groupId) {
|
||||
if (user?.userGroups?.[0]?.groupId) {
|
||||
// Utilisateur avec groupe assigné : TOUJOURS utiliser ce groupe (PRIORITÉ)
|
||||
groupId = user.userGroups[0].groupId;
|
||||
console.log("🎯 Customer Order Frontend: Using user's assigned group (PRIORITY):", groupId);
|
||||
} else if (user?.role === 'admin' && selectedStoreId) {
|
||||
// Admin avec magasin sélectionné ET pas de groupe assigné
|
||||
groupId = selectedStoreId;
|
||||
console.log("🎯 Customer Order Frontend: Using admin selected store:", groupId);
|
||||
} else if (user?.role === 'admin' && groups.length > 0) {
|
||||
// Admin sans sélection : premier groupe disponible
|
||||
groupId = groups[0].id;
|
||||
console.log("🎯 Customer Order Frontend: Using first group for admin:", groupId);
|
||||
} else if (groups.length > 0) {
|
||||
// EMERGENCY FALLBACK: Force assignment to first available group
|
||||
groupId = groups[0].id;
|
||||
console.log("⚠️ Customer Order Frontend: Emergency fallback to first group:", groupId);
|
||||
} else {
|
||||
// LAST RESORT: Hard-coded fallback
|
||||
groupId = 1;
|
||||
console.log("🚨 Customer Order Frontend: Using hard-coded groupId 1");
|
||||
}
|
||||
}
|
||||
// GroupId should already be correct from defaultValues - no override needed
|
||||
console.log("✅ Customer Order: Using groupId from form (defaultValues already correct):", groupId);
|
||||
|
||||
console.log("✅ CUSTOMER ORDER - Final groupId selected:", groupId, typeof groupId);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ Preferred communication style: Simple, everyday language.
|
||||
- **Reconciliation Module**: For balancing and tracking financial discrepancies. **PRODUCTION-READY**: Rebuilt with robust UI components to eliminate React #310 errors in production.
|
||||
- **Automatic Reconciliation System**: Dual-mode BL/Invoice reconciliation with automatic validation for suppliers in automatic mode. Auto-validates deliveries when status = "delivered" AND BL number exists.
|
||||
- **Permission System**: Granular, hardcoded permissions (54 permissions across 12 categories, assigned to 4 roles) for improved performance and maintenance. **EMPLOYEE PERMISSIONS**: Employees can create customer orders and DLC products.
|
||||
- **User Management**: Comprehensive features including user deletion with ownership transfer, consistent name and email field handling, and robust password hashing. **EMPLOYEE CUSTOMER ORDERS**: Fixed critical groupId assignment bug where employees assigned to store #2 were creating customer orders for store #1. Implemented dual-layer backend security with automatic groupId fallback from user assignments.
|
||||
- **User Management**: Comprehensive features including user deletion with ownership transfer, consistent name and email field handling, and robust password hashing. **EMPLOYEE CUSTOMER ORDERS FINAL**: Fixed critical groupId assignment bug where employees assigned to store #2 were creating customer orders for store #1. Root cause was missing userGroups in /api/user response + form defaultValues override logic. Implemented proper group prioritization in both defaultValues and removed override logic in handleSubmit.
|
||||
- **Calendar Synchronization**: Proper display of delivery dates and automatic synchronization of order statuses.
|
||||
- **Database Schema Download**: Admin-only feature to download comprehensive database structure reports.
|
||||
- **DLC Product Management**: **PRODUCTION-READY**: Corrected MemStorage implementation for proper DLC persistence in development. Cache invalidation fixed with exact:false for production compatibility. **GROUPID-FIX-FINAL**: Resolved issue where users assigned to store #2 were creating DLC products for store #1 by implementing dual-layer groupId fallback logic (frontend + backend security).
|
||||
|
||||
Reference in new issue
Block a user