Files
zerp/HOTFIX_20260212.md

172 lines
4.2 KiB
Markdown

# Hotfix Deployment - February 12, 2026
## Issues Fixed
### Issue 1: Internal Server Error on Contact Creation ❌ → ✅
**Problem**: Foreign key constraint violation when creating contacts
**Root Cause**: Form was sending empty string `""` for `parentId` field instead of `undefined`
**Fix**: Updated ContactForm to:
- Use `undefined` for optional fields instead of empty strings
- Clean data before submission to remove empty optional fields
- Properly handle `parentId` field
**File Modified**: `frontend/src/components/contacts/ContactForm.tsx`
### Issue 2: Category Checkboxes Not Clickable ❌ → ✅
**Problem**: Checkboxes in category selector didn't respond to clicks
**Root Cause**: Checkbox was a non-interactive `div` element
**Fix**: Changed checkbox from `div` to `button` with proper click handler
**File Modified**: `frontend/src/components/contacts/CategorySelector.tsx`
---
## Deployment Details
**Time**: 12:04 CET, February 12, 2026
**Method**: Hot fix deployment (frontend rebuild only)
**Downtime**: ~15 seconds (frontend restart)
**Status**: ✅ Deployed and running
---
## How to Test
### 1. Test Contact Creation (Previously Failing)
1. Login at https://zerp.atmata-group.com
- Email: `gm@atmata.com`
- Password: `Admin@123`
2. Go to Contacts page
3. Click "Add Contact"
4. Fill in the required fields:
- Contact Type: Individual
- Source: Website
- Name: Test Contact
5. ✅ Click "Create Contact"
6. ✅ Verify contact is created successfully (no more error)
### 2. Test Category Selection (Previously Not Working)
1. Click "Add Contact" again
2. Scroll down to "Categories" section
3. ✅ Click on any checkbox (Client, Partner, or Supplier)
4. ✅ Verify checkbox becomes selected (blue background)
5. ✅ Verify selected category appears as a chip above the tree
6. ✅ Click the X on the chip to remove selection
### 3. Test Category Creation
1. In Categories section, click the "+" button
2. Enter category name (e.g., "VIP Customer")
3. Click "Add Category"
4. ✅ Verify category appears in the tree
5. ✅ Click checkbox to select it
6. ✅ Create contact with the category assigned
---
## Fixed Code Changes
### ContactForm.tsx - Data Cleaning
```typescript
// Before (BROKEN)
parentId: contact?.parent?.id || '', // Empty string causes DB error
// After (FIXED)
parentId: contact?.parent?.id, // undefined if not present
// Added data cleaning before submit
const cleanData = Object.entries({ ...formData, rating }).reduce((acc, [key, value]) => {
if (value !== '' || ['type', 'name', 'source', 'country'].includes(key)) {
acc[key] = value
}
return acc
}, {} as any)
```
### CategorySelector.tsx - Interactive Checkbox
```typescript
// Before (BROKEN)
<div className="..."> {/* Not clickable */}
{isSelected && <Check />}
</div>
// After (FIXED)
<button
type="button"
onClick={(e) => {
e.stopPropagation()
toggleSelect(category.id)
}}
className="... cursor-pointer"
>
{isSelected && <Check />}
</button>
```
---
## Services Status
```
✅ Frontend: Running (Ready in 89ms)
✅ Backend: Running
✅ Database: Running (3 users seeded)
```
---
## Verification Checklist
- [x] Frontend rebuilt with fixes
- [x] Frontend restarted
- [x] Service responding (89ms ready time)
- [ ] Contact creation tested by user
- [ ] Category selection tested by user
---
## Known Working Features
After this fix, all the following should work:
✅ Login with `gm@atmata.com`
✅ View contacts list
✅ Create contacts (all fields)
✅ Select categories (checkboxes now work)
✅ Assign multiple categories
✅ Add tags
✅ Set rating
✅ Export contacts
✅ View contact details
✅ Edit contacts
✅ View history
---
## If You Still Have Issues
1. **Clear browser cache**: Press `Ctrl+Shift+R` (or `Cmd+Shift+R` on Mac)
2. **Check backend logs**:
```bash
ssh root@37.60.249.71
cd /root/z_crm
docker-compose logs backend --tail=50
```
3. **Restart all services** (if needed):
```bash
ssh root@37.60.249.71
cd /root/z_crm
docker-compose restart
```
---
**Status**: ✅ Fixed and Deployed
**Ready for Testing**: Now
Please test creating a contact with categories and let me know if it works!