fix: remove initial validation

feat:  remove birthday and birthmonth
This commit is contained in:
Marvin Flock
2025-04-02 19:22:27 +02:00
parent 1d2e3bb52f
commit 543aceaeab
4 changed files with 15 additions and 67 deletions
@@ -1379,7 +1379,6 @@ function adminSaveSpieler() {
$lizenz = $db->escape(trim($jinput->get('lizenz', '', 'RAW')));
$pseudonym = $db->escape(trim($jinput->get('pseudonym', '', 'RAW')));
$geschlecht = $db->escape(trim($jinput->get('geschlecht', 'M', 'RAW')));
$geburtsdatum = normalisiertesDatum($jinput->get('datum_jahr', 0, 'INT') == 0 ? null : sprintf("%04d-%02d-%02d", $jinput->get('datum_jahr', 0, 'INT'), $jinput->get('datum_monat', 0, 'INT'), $jinput->get('datum_tag', 0, 'INT')));
$geburtsjahr = $jinput->get('datum_jahr', 0, 'INT') == 0 ? null : sprintf("%d", $jinput->get('datum_jahr', 0, 'INT'));
$strasse = $db->escape(trim($jinput->get('strasse', '', 'RAW')));
$plz = $db->escape(trim($jinput->get('plz', '', 'RAW')));
@@ -1521,13 +1520,12 @@ function adminSaveSpieler() {
if ($id == 0 && !$beschraenkter_zugriff) {
$query = "INSERT INTO #__sportsmanager_spieler "
. "(vorname, nachname, lizenz, pseudonym, geschlecht, geburtsdatum, geburtsjahr, strasse, plz, ort, landeskennung, telefon, mobil, email, spielernr, lizenznr, elo_einzel_startwert, elo_doppel_startwert, bild_ausblenden) "
. "(vorname, nachname, lizenz, pseudonym, geschlecht, geburtsjahr, strasse, plz, ort, landeskennung, telefon, mobil, email, spielernr, lizenznr, elo_einzel_startwert, elo_doppel_startwert, bild_ausblenden) "
. "VALUES ('$vorname', "
. "'$nachname', "
. "'$lizenz', "
. "'$pseudonym', "
. "'$geschlecht', "
. ($geburtsdatum == null ? "NULL" : "'$geburtsdatum'") . ", "
. ($geburtsjahr == null ? "NULL" : "'$geburtsjahr'") . ", "
. "'$strasse', "
. "'$plz', "
@@ -1599,7 +1597,6 @@ function adminSaveSpieler() {
. "\n nachname = '$nachname',"
. "\n lizenz = '$lizenz',"
. "\n geschlecht = '$geschlecht',"
. "\n geburtsdatum = " . ($geburtsdatum == null ? "NULL" : "'$geburtsdatum'") . ","
. "\n geburtsjahr = " . ($geburtsjahr == null ? "NULL" : "'$geburtsjahr'") . ","
. "\n spielernr = '$spielernr',"
. "\n lizenznr = '$lizenznr',"
@@ -1278,57 +1278,32 @@ class HTML_sportsmanager_admin
</tr>
<tr>
<td nowrap width="20%" align="right" id="birthDateLabel">
<?php echo JText::_('COM_SPORTSMANAGER_BIRTHDATE') . '*' ?>:
<?php echo JText::_('COM_SPORTSMANAGER_BIRTHYEAR') . '*' ?>:
</td>
<td nowrap>
<?php
if (!$beschraenkter_zugriff)
{
?>
<select id="birthDay" class="uk-select uk-form-width-medium" name="datum_tag" size="1">
<select id="birthYear" class="uk-select uk-form-width-medium" name="datum_jahr" size="1" required>
<?php
$datum = "0000-00-00";
$date_year = '0000';
if ($row != null)
{
if ($row->geburtsdatum != null)
$datum = $row->geburtsdatum;
else if ($row->geburtsjahr != null)
$datum = sprintf("%04d-00-00", $row->geburtsjahr);
if ($row->geburtsjahr != null)
$date_year = sprintf("%04d", $row->geburtsjahr);
}
$datum_tag = substr($datum, 8, 2);
echo "<option value=\"0\"></option>";
for ($i = 1; $i <= 31; $i++)
{
echo "<option value=\"" . $i . "\" " . ($datum_tag == $i ? "selected" : "") . ">" . $i . "</option>";
}
?>
</select>
<select id="birthMonth" class="uk-select uk-form-width-medium" name="datum_monat" size="1">
<?php
$datum_monat = substr($datum, 5, 2);
echo "<option value=\"0\"></option>";
$monate = array(JText::_('COM_SPORTSMANAGER_JANUARY'), JText::_('COM_SPORTSMANAGER_FEBRUARY'), JText::_('COM_SPORTSMANAGER_MARCH'), JText::_('COM_SPORTSMANAGER_APRIL'), JText::_('COM_SPORTSMANAGER_MAY'), JText::_('COM_SPORTSMANAGER_JUNE'), JText::_('COM_SPORTSMANAGER_JULY'), JText::_('COM_SPORTSMANAGER_AUGUST'), JText::_('COM_SPORTSMANAGER_SEPTEMBER'), JText::_('COM_SPORTSMANAGER_OCTOBER'), JText::_('COM_SPORTSMANAGER_NOVEMBER'), JText::_('COM_SPORTSMANAGER_DECEMBER'));
for ($i = 1; $i <= 12; $i++)
{
echo "<option value=\"" . $i . "\" " . ($datum_monat == $i ? "selected" : "") . ">" . htmlentities_utf8($monate[$i - 1]) . "</option>";
}
?>
</select>
<select id="birthYear" class="uk-select uk-form-width-medium" name="datum_jahr" size="1">
<?php
$datum_jahr = substr($datum, 0, 4);
echo "<option value=\"0\"></option>";
echo "<option selected disabled value=''></option>";
for ($i = Date("Y"); $i >= 1930; $i--)
{
echo "<option value=\"" . $i . "\" " . ($datum_jahr == $i ? "selected" : "") . ">" . $i . "</option>";
echo "<option value=\"" . $i . "\" " . ($date_year == $i ? "selected" : "") . ">" . $i . "</option>";
}
?>
</select>
<small id="birthDateError" style="color: red"></small>
<?php
}
else if ($row != null && $row->geburtsdatum != null)
echo htmlentities_utf8(FormatiertesDatum($row->geburtsdatum, false, true));
else if ($row != null && $row->geburtsjahr != null)
echo htmlentities_utf8(sprintf("%04d", $row->geburtsjahr));
?>
</td>
</tr>
@@ -1624,27 +1599,6 @@ class HTML_sportsmanager_admin
<input type="hidden" name="id" value="<?php echo($row != null ? $row->spieler_id : "0"); ?>"/>
<input type="hidden" name="vereinsauswahl_anzahl" value="<?php echo $vereinsauswahl_anzahl; ?>"/>
</form>
<script>
function validate() {
let isValid = true;
// Clear errors
document.getElementById("birthDateError").textContent = "";
document.getElementById("birthDateLabel").style.color = "";
const birthDay = document.getElementById("birthDay").value;
const birthMonth = document.getElementById("birthMonth").value;
const birthYear = document.getElementById("birthYear").value;
if(birthDay === '0' || birthMonth === '0' || birthYear === '0') {
document.getElementById("birthDateError").textContent = "<?php echo JText::_('COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED'); ?>";
document.getElementById("birthDateLabel").style.color = "red";
isValid = false;
}
return isValid;
}
</script>
<?php
}
@@ -366,7 +366,7 @@ COM_SPORTSMANAGER_BIRTHYEAR="Geburtsjahr"
COM_SPORTSMANAGER_NAT="Nat. #"
COM_SPORTSMANAGER_INT="Intern. #"
COM_SPORTSMANAGER_REMOVE_MESSAGE="Willst du den Spieler wirklich entfernen?"
COM_SPORTSMANAGER_BIRTHDATE="Geburtstag"
COM_SPORTSMANAGER_BIRTHDATE = "Geburtstag"
COM_SPORTSMANAGER_PLACE_SHORTCUT="PLZ / Ort"
COM_SPORTSMANAGER_PHONE="Telefon"
COM_SPORTSMANAGER_MOBILE="Mobil"
@@ -925,5 +925,3 @@ COM_SPORTSMANAGER_RANK="Rang"
; SPIELER BEARBEITEN
COM_SPORTSMANAGER_LIZENZ="Lizenz"
COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED="Geburtstagsfelder dürfen nicht leer sein"
@@ -362,7 +362,7 @@ COM_SPORTSMANAGER_IDENTICAL_NAME="Identical name"
COM_SPORTSMANAGER_IDENTICAL_NAME_BIRTHYEAR="Identical name and birth year"
COM_SPORTSMANAGER_NO_PLAYERS="No player number"
COM_SPORTSMANAGER_LAST_FIRST_NAME="Last name, first name"
COM_SPORTSMANAGER_BIRTHYEAR="birthyear"
COM_SPORTSMANAGER_BIRTHYEAR="Birthyear"
COM_SPORTSMANAGER_NAT="Nat. #"
COM_SPORTSMANAGER_INT="Intern. #"
COM_SPORTSMANAGER_REMOVE_MESSAGE="Do you really want to remove the player?"
@@ -922,4 +922,3 @@ COM_SPORTSMANAGER_POINTS_TABLE="Points table"
COM_SPORTSMANAGER_EVALUATION="Auswertung"
COM_SPORTSMANAGER_FUNCTION_DESCRIPTION="Variables: n = number of participants, p = place, m = multiplier of rating and in doubles possibly additionally reduced rating<br />Functions: +, -, *, /, round(x), pow(x), if(a > b, x, y), min(x, y), max(x, y), log(x), ln(x), logn(b, x)<br />VerteilungR(r, p, n, m) := max(round((((m * r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1), 1)<br />Verteilung(r, p, n, m) := max(round(m * round((((r - 1) * (-log(p / n) * (1 - (p / n)))) / (-log(1 / n) * (1 - (1 / n)))) + 1)), 1)<br /><br />The functions VerteilungR() and Verteilung() distribute points for place 1 (r) descending to the individual places (p) of the number of participants (n).<br />VerteilungR() applies the multiplier (m) to the points for 1st place and then distributes down to 1 point for the last place.<br />Verteilung() applies the multiplier (m) to the points after the calculation, i.e. the last place receives 1 * m points."
COM_SPORTSMANAGER_LIZENZ="License"
COM_SPORTSMANAGER_ERROR_BIRTHDAY_REQUIRED="Birthday fields may not be empty"