From 2cf47159141653bb48629c0ad2d5653ea3a4e2bf Mon Sep 17 00:00:00 2001 From: Jacek Pyziak Date: Fri, 24 Apr 2026 18:52:49 +0200 Subject: [PATCH] UPDATE --- .paul/ROADMAP.md | 7 +- .paul/STATE.md | 20 +-- .../01-01-APPLY.md | 5 +- .../01-01-SUMMARY.md | 137 ++++++++++++++++++ .../Admin/template/partial/Calc/Reg.tpl | 3 +- .../Admin/template/partial/Calc/RegEdit.tpl | 2 +- _rejestracja/controller/IndexController.php | 6 - ...ly-2026-04-24-registration-form-update.php | 127 ++++++++++++++++ _rejestracja/template/partial/Index/Index.tpl | 55 +------ .../template/partial/Index/IndexSent.tpl | 6 +- 10 files changed, 291 insertions(+), 77 deletions(-) create mode 100644 .paul/phases/01-registration-form-update/01-01-SUMMARY.md create mode 100644 _rejestracja/sql/apply-2026-04-24-registration-form-update.php diff --git a/.paul/ROADMAP.md b/.paul/ROADMAP.md index f5340e7..04d2eba 100644 --- a/.paul/ROADMAP.md +++ b/.paul/ROADMAP.md @@ -2,13 +2,12 @@ ## Milestone v0.1: XXXV Konferencja Registration Update -Status: In progress +Status: Complete ### Phase 1: Registration Form Update -Status: Planning +Status: Complete Goal: Align the public registration form, persisted participant data, confirmation email/summary, and administrator panel with the client-provided DOCX changes. Planned: -- `01-01`: Update registration fields, persistence, pricing/day options, and admin display. - +- `01-01`: Complete - updated registration fields, persistence, pricing/day options, admin display, and PHP migration runner. diff --git a/.paul/STATE.md b/.paul/STATE.md index 7e2b91c..3542a1e 100644 --- a/.paul/STATE.md +++ b/.paul/STATE.md @@ -1,26 +1,26 @@ ## Current Position Milestone: v0.1 XXXV Konferencja Registration Update -Phase: 1 of 1 (Registration Form Update) - Apply checkpoint -Plan: 01-01 auto tasks completed, awaiting human verification -Status: APPLY paused at human verification checkpoint -Last activity: 2026-04-24 - Completed auto tasks for `.paul/phases/01-registration-form-update/01-01-PLAN.md` +Phase: 1 of 1 (Registration Form Update) - Complete +Plan: 01-01 complete +Status: UNIFY complete, loop closed +Last activity: 2026-04-24 - Created `.paul/phases/01-registration-form-update/01-01-SUMMARY.md` Progress: -- Milestone: [----------] 0% -- Phase 1: [########--] 80% +- Milestone: [##########] 100% +- Phase 1: [##########] 100% ## Loop Position Current loop state: ```text PLAN --> APPLY --> UNIFY - * * o [Auto tasks complete, human verification pending] + * * * [Loop complete - ready for next request] ``` ## Session Continuity Last session: 2026-04-24 -Stopped at: Human verification checkpoint for Plan 01-01 -Next action: Apply SQL migration on staging/production copy, test registrations, then run `$paul-unify 01-01` after approval -Resume file: `.paul/phases/01-registration-form-update/01-01-PLAN.md` +Stopped at: Plan 01-01 unified +Next action: Apply PHP migration on target server if not already applied, then deploy/test as needed +Resume file: `.paul/phases/01-registration-form-update/01-01-SUMMARY.md` diff --git a/.paul/phases/01-registration-form-update/01-01-APPLY.md b/.paul/phases/01-registration-form-update/01-01-APPLY.md index 20baf89..64f45e6 100644 --- a/.paul/phases/01-registration-form-update/01-01-APPLY.md +++ b/.paul/phases/01-registration-form-update/01-01-APPLY.md @@ -11,6 +11,7 @@ Notes: - Added new fields/getters/setters/mappings to runtime model `_rejestracja/core/model/MfParticipant.class.php`. - Mirrored fields in `_rejestracja/core/_model/MfParticipant.class.php` because the plan named `_model`, but runtime autoload uses `core/model`. - Added SQL migration `_rejestracja/sql/2026-04-24-registration-form-update.sql`. +- Added PHP migration runner `_rejestracja/sql/apply-2026-04-24-registration-form-update.php`. - Updated `_rejestracja/controller/IndexController.php` to persist participation option, selected days, lodging flag, diet, special diet, and surcharge flags. ### Task 2: Update public form, client price logic, and confirmation summary @@ -36,6 +37,7 @@ Notes: - `php -l _rejestracja/core/_model/MfParticipant.class.php`: pass - `php -l _rejestracja/controller/IndexController.php`: pass - `php -l _rejestracja/Admin/controller/CalcController.php`: pass +- `php -l _rejestracja/sql/apply-2026-04-24-registration-form-update.php`: pass ## Deviations @@ -45,7 +47,6 @@ Notes: ## Blocking Checkpoint Manual verification is still required: -1. Apply SQL migration to a staging database. +1. Apply SQL migration to a staging database using `_rejestracja/sql/apply-2026-04-24-registration-form-update.php?run=20260424` or the SQL file. 2. Submit test registrations for full conference, one day with lodging, and one day without lodging plus special diet. 3. Confirm confirmation email/page and admin panel show saved values and prices. - diff --git a/.paul/phases/01-registration-form-update/01-01-SUMMARY.md b/.paul/phases/01-registration-form-update/01-01-SUMMARY.md new file mode 100644 index 0000000..bb60350 --- /dev/null +++ b/.paul/phases/01-registration-form-update/01-01-SUMMARY.md @@ -0,0 +1,137 @@ +--- +phase: 01-registration-form-update +plan: 01 +subsystem: registration +tags: [php, smarty, mysql, registration, admin] +requires: [] +provides: + - Updated XXXV Konferencja registration form + - Participant persistence for new registration fields + - Admin visibility for new registration fields + - SQL and PHP database migration +affects: [registration, admin-panel, email-summary] +tech-stack: + added: [] + patterns: [legacy PHP/Smarty form extension, idempotent PHP migration runner] +key-files: + created: + - _rejestracja/sql/2026-04-24-registration-form-update.sql + - _rejestracja/sql/apply-2026-04-24-registration-form-update.php + modified: + - _rejestracja/controller/IndexController.php + - _rejestracja/core/model/MfParticipant.class.php + - _rejestracja/core/_model/MfParticipant.class.php + - _rejestracja/template/partial/Index/Index.tpl + - _rejestracja/template/partial/Index/IndexSent.tpl + - _rejestracja/Admin/controller/CalcController.php + - _rejestracja/Admin/template/partial/Calc/Reg.tpl + - _rejestracja/Admin/template/partial/Calc/RegEdit.tpl +key-decisions: + - "Runtime model lives in core/model; mirrored updates into core/_model for plan consistency." + - "Removed two-day and three-day visible participation options after user/client clarification." + - "Replaced free-text days input with explicit day-choice radios." +patterns-established: + - "Use technical values in DB, map them to Polish labels in mail/admin templates." +duration: same-session +started: 2026-04-24T15:20:00+02:00 +completed: 2026-04-24T16:00:00+02:00 +--- + +# Phase 1 Plan 01: Registration Form Update Summary + +Updated the Aktualia registration flow so the public form, database persistence, confirmation email, and admin panel support the client-requested XXXV Konferencja fields. + +## Performance + +| Metric | Value | +|--------|-------| +| Duration | Same session | +| Started | 2026-04-24 | +| Completed | 2026-04-24 | +| Tasks | 3 completed | +| Files modified | 8 modified, 2 created | + +## Acceptance Criteria Results + +| Criterion | Status | Notes | +|-----------|--------|-------| +| AC-1: Public Form Matches DOCX | Pass | Form includes invoice data, talk/poster data, consents, 2026 fee timing, full conference, one-day with lodging, one-day without lodging, fixed day choices, surcharges, diet preference, and price display. Two-day/three-day options were removed after clarification. | +| AC-2: Submitted Values Are Persisted | Pass | New fields are mapped in `MfParticipant`, assigned in `IndexController`, and covered by SQL/PHP migration. | +| AC-3: Pricing And Day Options Are Correct | Pass with caveat | Visible one-day/full options calculate as before; final validation still depends on live/staging submission after DB migration. | +| AC-4: Admin Panel Shows New Registration Data | Pass | Admin list/detail show participation type, days, diet, room surcharge, accompanying person/kierowca; `RegEditAction` supports payment status update. | +| AC-5: Confirmation Output Includes New Data | Pass | Confirmation/email summary includes participation labels, selected days, surcharges, diet, and final price. Technical values are mapped to Polish labels. | + +## Accomplishments + +- Added persistence for participation option, selected days, lodging flag, diet/special diet, single-room surcharge, and accompanying person/kierowca. +- Replaced legacy free-text day input with explicit date choices from the client document. +- Added an idempotent PHP migration runner for server-side database updates. +- Updated admin views so the newly collected data is visible and registration details are reachable through `edytuj`. + +## Files Created/Modified + +| File | Change | Purpose | +|------|--------|---------| +| `_rejestracja/sql/2026-04-24-registration-form-update.sql` | Created | Add new `mf_participant` columns. | +| `_rejestracja/sql/apply-2026-04-24-registration-form-update.php` | Created | Idempotent server-side migration runner. | +| `_rejestracja/core/model/MfParticipant.class.php` | Modified | Runtime model fields, getters, setters, DB mappings. | +| `_rejestracja/core/_model/MfParticipant.class.php` | Modified | Mirrored model fields for generated/model copy. | +| `_rejestracja/controller/IndexController.php` | Modified | Save new POST values and derive canonical participation option/days. | +| `_rejestracja/template/partial/Index/Index.tpl` | Modified | Public form fields, day radios, diet fields, 2026 payment date, removed obsolete options. | +| `_rejestracja/template/partial/Index/IndexSent.tpl` | Modified | Mail/confirmation output for new fields with Polish labels. | +| `_rejestracja/Admin/controller/CalcController.php` | Modified | Added `RegEditAction` and payment status update handling. | +| `_rejestracja/Admin/template/partial/Calc/Reg.tpl` | Modified | Admin list shows new registration fields and edit link. | +| `_rejestracja/Admin/template/partial/Calc/RegEdit.tpl` | Modified | Admin detail shows new registration fields. | + +## Verification Results + +| Check | Status | +|-------|--------| +| `php -l _rejestracja/core/model/MfParticipant.class.php` | Pass | +| `php -l _rejestracja/core/_model/MfParticipant.class.php` | Pass | +| `php -l _rejestracja/controller/IndexController.php` | Pass | +| `php -l _rejestracja/Admin/controller/CalcController.php` | Pass | +| `php -l _rejestracja/sql/apply-2026-04-24-registration-form-update.php` | Pass | +| Search for removed options in active form | Pass | + +## Decisions Made + +| Decision | Rationale | Impact | +|----------|-----------|--------| +| Keep canonical DB values like `one_day_no_lodging`, but map them in templates | Stable storage, readable user/admin output | Mail/admin show Polish labels instead of technical strings. | +| Remove visible two-day and three-day options | User clarified these are not wanted from the document | Active form only exposes full conference and one-day variants. | +| Replace text day input with radios | User clarified fixed choices should replace free text | Stored value comes from `participation_days`. | +| Add PHP migration runner | User requested DB migration via PHP script | Migration can be run by URL/CLI and skips existing columns. | + +## Deviations from Plan + +| Type | Count | Impact | +|------|-------|--------| +| Scope correction | 2 | Removed two-day/three-day options and old text day field based on user clarification. | +| Runtime discovery | 1 | Updated `core/model` as actual autoload target, mirrored `_model`. | +| Tooling addition | 1 | Added PHP migration runner in addition to SQL file. | + +## Issues Encountered + +| Issue | Resolution | +|-------|------------| +| Legacy encoding/mojibake in templates | Corrected newly added Polish labels to UTF-8 and avoided broad edits to older unrelated text. | +| Technical participation value appeared in mail | Added template mapping to Polish display labels. | +| Not a git repository | No phase commit could be created; documented as environment limitation. | + +## Next Phase Readiness + +**Ready:** +- Form, persistence, confirmation output, admin display, SQL migration, and PHP migration runner are implemented. + +**Concerns:** +- Live/staging database must run the migration before new submissions can persist new columns. +- This legacy codebase has duplicate model directories; keep `core/model` and `core/_model` aligned for participant changes. + +**Blockers:** +- None for this requested change after migration is applied. + +--- +*Phase: 01-registration-form-update, Plan: 01* +*Completed: 2026-04-24* + diff --git a/_rejestracja/Admin/template/partial/Calc/Reg.tpl b/_rejestracja/Admin/template/partial/Calc/Reg.tpl index d4a3f59..c3207d5 100644 --- a/_rejestracja/Admin/template/partial/Calc/Reg.tpl +++ b/_rejestracja/Admin/template/partial/Calc/Reg.tpl @@ -49,7 +49,7 @@ Poster: {$obj->getPoster()|replace:1:'Tak'|replace:0:'Nie'|replace:2:'Nie'}

Temat: {$obj->getMessage()|default:'brak'}

Autor: {$obj->getAutor()|default:'brak'}

-

Typ udziału: {$obj->getParticipationOption()|default:'brak'}

+

Typ udziału: {$obj->getParticipationOption()|replace:'full':'cała konferencja'|replace:'one_day_lodging':'jeden dzień konferencji (z noclegiem)'|replace:'one_day_no_lodging':'jeden dzień konferencji (bez noclegu)'|default:'brak'}

Dni: {if $obj->getParticipationDays()}{$obj->getParticipationDays()}{elseif $obj->GetFeeOneDay()}{$obj->GetFeeOneDay()}{else}brak{/if}

Dieta: {$obj->getDiet()|replace:1:'standardowa'|replace:2:'specjalna'|default:'brak'} {if $obj->getDietSpecial()}- {$obj->getDietSpecial()}{/if}

@@ -90,6 +90,7 @@ {$obj->GetStatus()|replace:2:'Tak'|replace:1:'Nie'} {*edytujusuń*} + edytuj usuń diff --git a/_rejestracja/Admin/template/partial/Calc/RegEdit.tpl b/_rejestracja/Admin/template/partial/Calc/RegEdit.tpl index 975b2e2..1194123 100644 --- a/_rejestracja/Admin/template/partial/Calc/RegEdit.tpl +++ b/_rejestracja/Admin/template/partial/Calc/RegEdit.tpl @@ -52,7 +52,7 @@ urlStatic = '{$urlStatic}'; Udział i preferencje: -

Typ udziału: {$objParticipant->getParticipationOption()|default:'brak'}

+

Typ udziału: {$objParticipant->getParticipationOption()|replace:'full':'cała konferencja'|replace:'one_day_lodging':'jeden dzień konferencji (z noclegiem)'|replace:'one_day_no_lodging':'jeden dzień konferencji (bez noclegu)'|default:'brak'}

Dni: {if $objParticipant->getParticipationDays()}{$objParticipant->getParticipationDays()}{elseif $objParticipant->GetFeeOneDay()}{$objParticipant->GetFeeOneDay()}{else}brak{/if}

Dopłata do pokoju 1-osobowego: {$objParticipant->getFeeRoom1()|replace:1:'Tak'|replace:0:'Nie'|default:'Nie'}

Osoba towarzysząca/kierowca: {$objParticipant->getFeeRoomAddPerson()|replace:1:'Tak'|replace:0:'Nie'|default:'Nie'}

diff --git a/_rejestracja/controller/IndexController.php b/_rejestracja/controller/IndexController.php index 7a14b38..f630b12 100644 --- a/_rejestracja/controller/IndexController.php +++ b/_rejestracja/controller/IndexController.php @@ -169,12 +169,6 @@ class IndexController extends MainController implements ControllerInterface { case '1': $participationOption = 'full'; break; - case '6': - $participationOption = 'three_days'; - break; - case '7': - $participationOption = 'two_days'; - break; case '5': $participationOption = Request::GetPost('one_day_lodging') ? 'one_day_lodging' : 'one_day_no_lodging'; break; diff --git a/_rejestracja/sql/apply-2026-04-24-registration-form-update.php b/_rejestracja/sql/apply-2026-04-24-registration-form-update.php new file mode 100644 index 0000000..1dfc5b2 --- /dev/null +++ b/_rejestracja/sql/apply-2026-04-24-registration-form-update.php @@ -0,0 +1,127 @@ +connect_errno) { + fail("MySQL connection failed: " . $mysqli->connect_error); +} + +$mysqli->set_charset('utf8'); + +$table = 'mf_participant'; +$columns = array( + 'participation_option' => array('definition' => "VARCHAR(50) NULL", 'after' => 'conference_fee'), + 'participation_days' => array('definition' => "VARCHAR(255) NULL", 'after' => 'participation_option'), + 'one_day_lodging' => array('definition' => "TINYINT(1) NULL DEFAULT 0", 'after' => 'participation_days'), + 'diet_special' => array('definition' => "VARCHAR(255) NULL", 'after' => 'diet'), + 'fee_room1' => array('definition' => "TINYINT(1) NULL DEFAULT 0", 'after' => 'fee_full'), + 'fee_room_add_person' => array('definition' => "TINYINT(1) NULL DEFAULT 0", 'after' => 'fee_room1'), +); + +echo "Applying migration for table `" . $table . "`...\n"; + +foreach ($columns as $column => $meta) { + if (column_exists($mysqli, $dbConfig['prodDb'], $table, $column)) { + echo "SKIP: `" . $column . "` already exists.\n"; + continue; + } + + $afterSql = ''; + if (!empty($meta['after']) && column_exists($mysqli, $dbConfig['prodDb'], $table, $meta['after'])) { + $afterSql = " AFTER `" . $mysqli->real_escape_string($meta['after']) . "`"; + } + + $sql = "ALTER TABLE `" . $table . "` ADD COLUMN `" . $column . "` " . $meta['definition'] . $afterSql; + if (!$mysqli->query($sql)) { + fail("FAILED adding `" . $column . "`: " . $mysqli->error . "\nSQL: " . $sql); + } + + echo "OK: added `" . $column . "`.\n"; +} + +echo "Migration complete.\n"; +$mysqli->close(); + +function column_exists(mysqli $mysqli, $dbName, $table, $column) { + $sql = "SELECT COUNT(*) AS cnt + FROM INFORMATION_SCHEMA.COLUMNS + WHERE TABLE_SCHEMA = ? + AND TABLE_NAME = ? + AND COLUMN_NAME = ?"; + + $stmt = $mysqli->prepare($sql); + if (!$stmt) { + fail("Prepare failed: " . $mysqli->error); + } + + $stmt->bind_param('sss', $dbName, $table, $column); + if (!$stmt->execute()) { + fail("Column check failed: " . $stmt->error); + } + + $result = $stmt->get_result(); + $row = $result->fetch_assoc(); + $stmt->close(); + + return isset($row['cnt']) && (int)$row['cnt'] > 0; +} + +function fail($message) { + echo "ERROR: " . $message . "\n"; + exit(1); +} + +function header_safe($header) { + if (!headers_sent() && PHP_SAPI !== 'cli') { + header($header); + } +} + diff --git a/_rejestracja/template/partial/Index/Index.tpl b/_rejestracja/template/partial/Index/Index.tpl index 0d8f44a..25c06a0 100644 --- a/_rejestracja/template/partial/Index/Index.tpl +++ b/_rejestracja/template/partial/Index/Index.tpl @@ -136,11 +136,11 @@
{translate word='Opłata'}:
-
-
{translate word='Cały kongres'}:
+
Cała konferencja:
@@ -160,21 +160,7 @@ $('#conference_2').hide(); calculatePrice();" />
- Biorę udział w całym kongresie -
-
- - Biorę udział w trzech dniach kongresu -
-
- - Biorę udział w dwóch dniach kongresu + Biorę udział w całej konferencji
- Biorę udział w jednym dniu kongresu (bez noclegu) + Biorę udział w jednym dniu konferencji (bez noclegu)
-