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

@@ -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()}