Skip to content

Commit

Permalink
Vorausfüllen von Teilnehmernamen unterschiedet nun Veranstaltungen fü…
Browse files Browse the repository at this point in the history
…r Kinder
  • Loading branch information
simonkrauter committed Mar 12, 2021
1 parent f5202f8 commit 572e8a8
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
18 changes: 17 additions & 1 deletion booking.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ function handleSaveBookingAction()
echo 'showErrorMsg("Der Name darf kein Semikolon enthalten.");';
return;
}
if (contains($surname, '|') or contains($lastname, '|'))
{
echo 'showErrorMsg("Der Name darf keinen senkrechten Strich enthalten.");';
return;
}
$person = $surname . ',' . $lastname;
if (in_array($person, $persons))
{
Expand Down Expand Up @@ -235,8 +240,19 @@ function handleSaveBookingAction()
# update client row
if (!$asAdmin)
{
$personGroups = explode('|', getClientValue('lastListOfPersons'), 2);
if ($event['isKidsEvent'] == 1)
{
if (count($personGroups) < 2)
$personGroups[] = '';
$personGroups[1] = $listOfPersons;
}
else
{
$personGroups[0] = $listOfPersons;
}
$clientValues = [];
$clientValues['lastListOfPersons'] = $listOfPersons;
$clientValues['lastListOfPersons'] = implode('|', $personGroups);
$clientValues['lastPhoneNumber'] = $phoneNumber;
$clientValues['lastAddressLine1'] = $addressLine1;
$clientValues['lastAddressLine2'] = $addressLine2;
Expand Down
1 change: 1 addition & 0 deletions create-database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ CREATE TABLE event (
bookingClosingTimestamp TIMESTAMP NULL,
canceled TINYINT,
isHighPriority TINYINT,
isKidsEvent TINYINT,
remark TEXT,
insertTimestamp TIMESTAMP NULL,
editClientId INT,
Expand Down
5 changes: 5 additions & 0 deletions event.php
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,12 @@ function getEventFields()
$field['visibleInList'] = false;
$fields[] = $field;

$field = newBooleanField('isKidsEvent', 'Für Kinder');
$field['visibleInList'] = false;
$fields[] = $field;

$field = newBooleanField('isHighPriority', 'Hohe Priorität');
$field['visibleInList'] = false;
$fields[] = $field;

$field = newBooleanField('canceled', 'Abgesagt');
Expand Down
7 changes: 6 additions & 1 deletion ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,12 @@ function renderMainPageSaveBookingForm($event, $asAdmin, $persons = null, $booki

if (!$asAdmin && $persons == null)
{
$persons = explode(';', getClientValue('lastListOfPersons'));
$personGroups = explode('|', getClientValue('lastListOfPersons'), 2);
if ($event['isKidsEvent'] == 1 && count($personGroups) == 2)
$personGroup = $personGroups[1];
else
$personGroup = $personGroups[0];
$persons = explode(';', $personGroup);
}
$phoneNumber = getClientValue('lastPhoneNumber');
$addressLine1 = getClientValue('lastAddressLine1');
Expand Down
3 changes: 2 additions & 1 deletion update-database-1.6-1.8.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ALTER TABLE event
ADD (isHighPriority TINYINT);
ADD (isHighPriority TINYINT,
isKidsEvent TINYINT);

0 comments on commit 572e8a8

Please sign in to comment.