Files
2026-04-27 17:46:12 +02:00

133 lines
6.0 KiB
Markdown

---
phase: 03-registration-form-settings
plan: 02
subsystem: ui
tags: [php, smarty, mysql, registration, form]
requires:
- phase: 01-registration-form-update
provides: MfParticipant model, IndexController save flow, Reg.tpl admin display
provides:
- additional_info TEXT column in mf_participant (idempotent migration)
- MfParticipant::getAdditionalInfo / setAdditionalInfo
- "Dodatkowe informacje" textarea in public registration form (Index.tpl, Index_good.tpl)
- KSeF helper note relocated above new field
- Field displayed in confirmation templates (IndexSent.tpl, IndexSent_good.tpl)
- Field displayed in admin Reg.tpl institution column
- Admin Reg table ordered newest-first (id_mf_participant DESC)
affects: []
tech-stack:
added: []
patterns:
- "Raw <textarea> for multi-line optional fields (formField plugin does not support textarea type)"
- "CalcController.php RegAction sort set via setSortBy — value injected directly into ORDER BY"
key-files:
created:
- _rejestracja/sql/2026-04-27-additional-info-field.sql
- _rejestracja/sql/apply-2026-04-27-additional-info-field.php
modified:
- _rejestracja/core/model/MfParticipant.class.php
- _rejestracja/controller/IndexController.php
- _rejestracja/template/partial/Index/Index.tpl
- _rejestracja/template/partial/Index/Index_good.tpl
- _rejestracja/template/partial/Index/IndexSent.tpl
- _rejestracja/template/partial/Index/IndexSent_good.tpl
- _rejestracja/Admin/template/partial/Calc/Reg.tpl
- _rejestracja/Admin/controller/CalcController.php
key-decisions:
- "Use raw <textarea rows=3> instead of {formField} — framework plugin does not support textarea type"
- "DB column named additional_info (TEXT) despite original KSeF context — generic name matches visible label"
- "KSeF helper note kept as dictionary translation but relocated above the new textarea (not inside NIP div)"
patterns-established:
- "Idempotent migration runner pattern: INFORMATION_SCHEMA column check before ALTER TABLE"
duration: ~15min
started: 2026-04-27T00:00:00Z
completed: 2026-04-27T00:00:00Z
---
# Phase 3 Plan 02: Dodatkowe informacje Field + Admin Table Order
**Optional free-text "Dodatkowe informacje" textarea added to registration form with DB persistence, KSeF helper note relocated above it, field shown in confirmations and admin panel, admin Reg table reversed to newest-first.**
## Performance
| Metric | Value |
|--------|-------|
| Duration | ~15 min |
| Tasks | 3/3 completed |
| Files modified | 8 |
| Files created | 2 |
## Acceptance Criteria Results
| Criterion | Status | Notes |
|-----------|--------|-------|
| AC-1: Field in Public Form | Pass | Helper note above textarea in Index.tpl and Index_good.tpl |
| AC-2: Value Persisted to DB | Pass | IndexController saves via setAdditionalInfo(Request::GetPost('additional_info')) |
| AC-3: Field in Confirmation | Pass | IndexSent.tpl and IndexSent_good.tpl show field after NIP |
| AC-4: Field in Admin Panel | Pass | Reg.tpl institution cell shows field after NIP |
| AC-5: Admin Table Reversed | Pass | CalcController RegAction: setSortBy('id_mf_participant DESC') |
| AC-6: Idempotent Migration | Pass | PHP runner checks INFORMATION_SCHEMA before ALTER TABLE |
## Accomplishments
- New `additional_info` TEXT column added to `mf_participant` with safe idempotent runner.
- KSeF helper text moved from inside NIP field div to above the new "Dodatkowe informacje" textarea.
- Field persisted on form submit and displayed in all output surfaces (confirmation, email, admin).
- Admin `/Calc/Reg` table now shows newest registrations first without any schema change.
## Files Created/Modified
| File | Change | Purpose |
|------|--------|---------|
| `_rejestracja/sql/2026-04-27-additional-info-field.sql` | Created | Raw ALTER TABLE SQL |
| `_rejestracja/sql/apply-2026-04-27-additional-info-field.php` | Created | Idempotent migration runner (?run=20260427) |
| `_rejestracja/core/model/MfParticipant.class.php` | Modified | Added additional_info field mapping, property, getter/setter |
| `_rejestracja/controller/IndexController.php` | Modified | Saves additional_info from POST |
| `_rejestracja/template/partial/Index/Index.tpl` | Modified | Moved helper text, added textarea below NIP |
| `_rejestracja/template/partial/Index/Index_good.tpl` | Modified | Same changes as Index.tpl |
| `_rejestracja/template/partial/Index/IndexSent.tpl` | Modified | Shows field in confirmation summary |
| `_rejestracja/template/partial/Index/IndexSent_good.tpl` | Modified | Shows field in alternate confirmation |
| `_rejestracja/Admin/template/partial/Calc/Reg.tpl` | Modified | Shows field in admin institution column |
| `_rejestracja/Admin/controller/CalcController.php` | Modified | RegAction sorted DESC by id_mf_participant |
## Decisions Made
| Decision | Rationale | Impact |
|----------|-----------|--------|
| Raw `<textarea>` not `{formField}` | `formField` Smarty plugin supports only `type="text"` / `type="hidden"` | Must use raw textarea for multi-line fields |
| Column name `additional_info` | Label changed from "ID KSeF" to "Dodatkowe informacje" — generic column name avoids future confusion | Neutral; column stores any free text |
## Deviations from Plan
None — plan executed exactly as written.
## Issues Encountered
None.
## Next Phase Readiness
**Ready:**
- Phase 3 feature work complete. Both plans (03-01 form settings admin page, 03-02 additional field) delivered.
- Production deployment requires two migration runners:
1. `/_rejestracja/sql/apply-2026-04-24-registration-form-settings.php?run=20260424` (from 03-01)
2. `/_rejestracja/sql/apply-2026-04-27-additional-info-field.php?run=20260427` (from 03-02)
**Concerns:**
- Plan 03-01 APPLY was completed but UNIFY was never run — no 03-01-SUMMARY.md exists. Phase not formally closed until 03-01 is also unified.
**Blockers:**
- None for further development. Deployment migration must precede production use of the new field.
---
*Phase: 03-registration-form-settings, Plan: 02*
*Completed: 2026-04-27*