mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-12 01:37:40 +02:00
Merge pull request #55 from R0m1k3/1.1
Fix customer order creation to use the correct store group
This commit is contained in:
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