fix: imported records cannot be edited after import (Closes #161) #189

Merged
shahondin1624 merged 1 commits from feature/issue-161-bug-imported-records-cannot-be-edited-after-import into main 2026-04-10 19:33:18 +02:00
Owner

Summary

Fixes the bug where records imported via CSV/ZIP import wizard could not be edited in the UI. The root cause was that the frontend's save() function sent read-only system fields (createdAt, updatedAt, deletedAt, id) alongside editable fields in the PUT request. This polluted the backend's validation merge and could cause unexpected behavior. Additionally, save errors replaced the entire form view, making failures appear silent.

Changes

  • Frontend (MemberDetail.vue): Explicitly construct the update payload with only editable member fields, matching the pattern already used in FamilyDetail.vue
  • Frontend (MemberDetail.vue): Add inline save error banner (saveError ref) that displays within the form instead of replacing it via the v-else-if chain
  • Backend (MemberService::update): Add field allowlist using array_intersect_key to filter out any non-editable fields before processing
  • Backend (MemberService::update): Add missing einwilligungDatum setter in the update field chain
  • Tests: Add testUpdateFiltersOutSystemFields and testUpdateImportedMemberSucceeds tests

Closes #161

## Summary Fixes the bug where records imported via CSV/ZIP import wizard could not be edited in the UI. The root cause was that the frontend's `save()` function sent read-only system fields (`createdAt`, `updatedAt`, `deletedAt`, `id`) alongside editable fields in the PUT request. This polluted the backend's validation merge and could cause unexpected behavior. Additionally, save errors replaced the entire form view, making failures appear silent. ### Changes - **Frontend (`MemberDetail.vue`)**: Explicitly construct the update payload with only editable member fields, matching the pattern already used in `FamilyDetail.vue` - **Frontend (`MemberDetail.vue`)**: Add inline save error banner (`saveError` ref) that displays within the form instead of replacing it via the `v-else-if` chain - **Backend (`MemberService::update`)**: Add field allowlist using `array_intersect_key` to filter out any non-editable fields before processing - **Backend (`MemberService::update`)**: Add missing `einwilligungDatum` setter in the update field chain - **Tests**: Add `testUpdateFiltersOutSystemFields` and `testUpdateImportedMemberSucceeds` tests Closes #161
shahondin1624 added 1 commit 2026-04-10 19:33:13 +02:00
- Strip read-only/system fields (createdAt, updatedAt, deletedAt, id)
  from the member update payload in both frontend and backend to prevent
  field pollution during validation
- Add inline save error banner so errors don't replace the form and lose
  user edits
- Add missing einwilligungDatum setter in MemberService::update()
- Add field allowlist in MemberService::update() using array_intersect_key
- Add tests for update with system fields and imported member edit flow

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
shahondin1624 merged commit 64ece89101 into main 2026-04-10 19:33:18 +02:00
shahondin1624 deleted branch feature/issue-161-bug-imported-records-cannot-be-edited-after-import 2026-04-10 19:33:18 +02:00
Sign in to join this conversation.