This commit is contained in:
2026-04-24 18:52:49 +02:00
parent 20d40fead4
commit 2cf4715914
10 changed files with 291 additions and 77 deletions

View File

@@ -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.

View File

@@ -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`

View File

@@ -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.

View File

@@ -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*

View File

@@ -49,7 +49,7 @@
Poster: {$obj->getPoster()|replace:1:'Tak'|replace:0:'Nie'|replace:2:'Nie'}
<p>Temat: {$obj->getMessage()|default:'brak'}</p>
<p>Autor: {$obj->getAutor()|default:'brak'}</p>
<p>Typ udziału: {$obj->getParticipationOption()|default:'brak'}</p>
<p>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'}</p>
<p>Dni: {if $obj->getParticipationDays()}{$obj->getParticipationDays()}{elseif $obj->GetFeeOneDay()}{$obj->GetFeeOneDay()}{else}brak{/if}</p>
<p>Dieta: {$obj->getDiet()|replace:1:'standardowa'|replace:2:'specjalna'|default:'brak'} {if $obj->getDietSpecial()}- {$obj->getDietSpecial()}{/if}</p>
</td>
@@ -90,6 +90,7 @@
<td {$display}>{$obj->GetStatus()|replace:2:'Tak'|replace:1:'Nie'}</td>
<td style="width:15px">
{*<a href="{url Calc=Edit id=$id}" class="edit">edytuj</a><a href="{url Calc=Delete id=$id}" class="delete">usuń</a>*}
<a href="{url Calc=RegEdit id=$id}" class="edit">edytuj</a>
<a href="{url Calc=RegDelete id=$id location=1}" onclick="{literal}if (confirm('Czy napewno usunąć ten element?')) { } else {return false;}{/literal}" class="delete">usuń</a>
</td>
</tr>

View File

@@ -52,7 +52,7 @@ urlStatic = '{$urlStatic}';
<tr>
<td>Udział i preferencje:</td>
<td class="left">
<p>Typ udziału: {$objParticipant->getParticipationOption()|default:'brak'}</p>
<p>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'}</p>
<p>Dni: {if $objParticipant->getParticipationDays()}{$objParticipant->getParticipationDays()}{elseif $objParticipant->GetFeeOneDay()}{$objParticipant->GetFeeOneDay()}{else}brak{/if}</p>
<p>Dopłata do pokoju 1-osobowego: {$objParticipant->getFeeRoom1()|replace:1:'Tak'|replace:0:'Nie'|default:'Nie'}</p>
<p>Osoba towarzysząca/kierowca: {$objParticipant->getFeeRoomAddPerson()|replace:1:'Tak'|replace:0:'Nie'|default:'Nie'}</p>

View File

@@ -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;

View File

@@ -0,0 +1,127 @@
<?php
/**
* One-off migration runner for XXXV Konferencja registration form fields.
*
* Usage:
* - Browser: /_rejestracja/sql/apply-2026-04-24-registration-form-update.php?run=20260424
* - CLI: php apply-2026-04-24-registration-form-update.php --run
*
* Remove this file from the server after a successful production run.
*/
ini_set('display_errors', 1);
error_reporting(E_ALL);
$isCli = PHP_SAPI === 'cli';
$approved = $isCli
? in_array('--run', $argv, true)
: (isset($_GET['run']) && $_GET['run'] === '20260424');
header_safe('Content-Type: text/plain; charset=utf-8');
if (!$approved) {
echo "DRY RUN ONLY\n";
echo "To apply migration, run with ?run=20260424 in browser or --run in CLI.\n";
echo "No database changes were made.\n";
exit;
}
$configPath = __DIR__ . '/../core/config/Strona/db.config.ini';
if (!is_file($configPath)) {
fail("Config file not found: " . $configPath);
}
$config = parse_ini_file($configPath, true);
if (!isset($config['db'])) {
fail("Missing [db] section in config.");
}
$dbConfig = $config['db'];
foreach (array('prodHost', 'prodUser', 'prodPass', 'prodDb') as $key) {
if (!array_key_exists($key, $dbConfig)) {
fail("Missing db config key: " . $key);
}
}
$mysqli = new mysqli(
$dbConfig['prodHost'],
$dbConfig['prodUser'],
$dbConfig['prodPass'],
$dbConfig['prodDb']
);
if ($mysqli->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);
}
}

View File

@@ -136,11 +136,11 @@
<div class="label">{translate word='Opłata'}: </div>
<div class="value">
<div class="confOption">
<label class="control control--radio">Opłata obniżona (płatność do 03.10.2025)
<label class="control control--radio">Opłata obniżona (płatność do 03.10.2026)
<input type="radio" name="conference_fee_disc" id="conference_fee_disc" checked="true" class="conference_fee_disc" value="1" onclick="calculatePrice();"/>
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Opłata zwykła (płatność po 03.10.2025)
<label class="control control--radio">Opłata zwykła (płatność po 03.10.2026)
<input type="radio" name="conference_fee_disc" id="conference_fee_norm" class="conference_fee_disc" value="2" onclick="calculatePrice();"/>
<div class="control__indicator"></div>
</label>
@@ -148,7 +148,7 @@
</div>
</div>
<div class="entry">
<div class="label">{translate word='Cały kongres'}: </div>
<div class="label">Cała konferencja: </div>
<div class="value">
<input type="hidden" name="participation_option" id="participation_option" value="full" />
<input type="hidden" name="one_day_lodging" id="one_day_lodging" value="0" />
@@ -160,21 +160,7 @@
$('#conference_2').hide(); calculatePrice();" />
<div class="control__indicator"></div>
</label>
<span>Biorę udział w całym kongresie</span>
</div>
<div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px;">
<label class="control control--radio">&nbsp;
<input type="radio" name="conference_fee" id="conference_fee_3" class="conference_fee" value="6" onclick="calculatePrice()" />
<div class="control__indicator"></div>
</label>
<span>Biorę udział w trzech dniach kongresu</span>
</div>
<div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px;">
<label class="control control--radio">&nbsp;
<input type="radio" name="conference_fee" id="conference_fee_2" class="conference_fee" value="7" onclick="calculatePrice()" />
<div class="control__indicator"></div>
</label>
<span>Biorę udział w dwóch dniach kongresu</span>
<span>Biorę udział w całej konferencji</span>
</div>
<div style="width:100%; display:flex; flex-wrap:no-wrap; align-items:start; gap;10px; margin-bottom:30px;">
<label class="control control--radio">&nbsp;
@@ -188,12 +174,8 @@
<input type="radio" name="conference_fee" id="conference_fee_1" class="conference_fee" value="5" onclick="calculatePrice()" />
<div class="control__indicator"></div>
</label>
<span>Biorę udział w jednym dniu kongresu (bez noclegu)</span>
<span>Biorę udział w jednym dniu konferencji (bez noclegu)</span>
</div>
<div class="show--day-select" id="show--day-select" style="display:none; width:100%; margin-bottom:30px; flex-direction:column; gap:10px;">
<label class="" for="days" style="width:100%;"> Wskaż dzień/dni swojej obecności * </label>
<input type="text" name="days" class="" id="days" >
</div>
<div class="show--day-select" id="one-day-lodging-days" style="display:none; width:100%; margin-bottom:30px; flex-direction:column; gap:10px;">
<span>Proszę zaznaczyć dzień:</span>
<label class="control control--radio">3/4 listopada
@@ -229,30 +211,15 @@
$('.conference_fee').on('change', showSelectDate);
function showSelectDate() {
const $form = $('#show--day-select');
const selectedId = $('.conference_fee:checked').attr('id');
$('#one_day_lodging').val('0');
$('#participation_option').val('full');
$('#one-day-lodging-days').hide();
$('#one-day-no-lodging-days').hide();
if ( selectedId === 'conference_fee_1' ||
selectedId === 'conference_fee_2' ||
selectedId === 'conference_fee_3' ) {
$form.css('display', 'flex');
} else {
$form.css('display', 'none');
}
if (selectedId === 'conference_fee_3') {
$('#participation_option').val('three_days');
}
if (selectedId === 'conference_fee_2') {
$('#participation_option').val('two_days');
}
if (selectedId === 'conference_fee_1_lodging') {
$('#participation_option').val('one_day_lodging');
$('#one_day_lodging').val('1');
$form.hide();
$('#one-day-lodging-days').css('display', 'flex');
}
if (selectedId === 'conference_fee_1') {
@@ -286,18 +253,6 @@
price_info += 'cała conf ';
}
if ($('#conference_fee_3').is(':checked')) {
sumPrice = !promo ? 2200 : 2500;
sumPriceVat = !promo ? 2706 : 3075;
price_info += '3-dniowa';
}
if ($('#conference_fee_2').is(':checked')) {
sumPrice = !promo ? 1800 : 2100;
sumPriceVat = !promo ? 2214 : 2583;
price_info += '2-dniowa';
}
if ($('#conference_fee_1').is(':checked')) {
sumPrice = !promo ? 1300 : 1600;
sumPriceVat = !promo ? 1599 : 1968;

View File

@@ -47,9 +47,9 @@
<div class="divTableFormRow">
<div class="divTableFormCell"><h3>Informacja o kwocie do zapłaty:</h3>
{if $discPrice == 2}
Opłata zwykła (płatność <b>po 03.10.2025</b>)
Opłata zwykła (płatność <b>po 03.10.2026</b>)
{else}
Opłata obniżona (płatność <b>do 03.10.2025</b>)
Opłata obniżona (płatność <b>do 03.10.2026</b>)
{/if}
<ul>
{foreach $arrayObjParameters as $objParam}
@@ -95,7 +95,7 @@
<div class="divTableFormRow">
<div class="divTableFormCell"><h3>Wybrana opcja udziału:</h3>
<p><b>Typ udziału:</b> {$objParticipant->getParticipationOption()|default:'pełna konferencja'}</p>
<p><b>Typ udziału:</b> {$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:'cała konferencja'}</p>
{if $days}
<p><b>Wskazane dni obecności:</b> {$days}</p>
{elseif $objParticipant->getParticipationDays()}