mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-06-10 06:27:52 +00:00
Automatische Spielberichtskorrektur bei doppelter Spielnummer
This commit is contained in:
@@ -10522,7 +10522,7 @@ function adminEditBegegnungSpielplan($bestaetigen): void
|
||||
if (count($rows) < 1) die("Wrong id!");
|
||||
$gast_team = $rows[0];
|
||||
|
||||
$query = "SELECT * FROM #__sportsmanager_teamspiel WHERE begegnung_id = $id ORDER BY teamspiel_nummer";
|
||||
$query = "SELECT * FROM #__sportsmanager_teamspiel WHERE begegnung_id = $id ORDER BY teamspiel_nummer, teamspiel_id";
|
||||
$spiele = loadObjectList($db, $query);
|
||||
$query = "SELECT *"
|
||||
. "\n FROM #__sportsmanager_mitglied_von_team as t1"
|
||||
@@ -10953,6 +10953,36 @@ function adminSaveBegegnungSpielplan(): void
|
||||
if (!$db->execute()) {
|
||||
abortWithError($db->stderr(true));
|
||||
}
|
||||
|
||||
// Spielbericht auf Fehler (doppelte Einträge) überprüfen
|
||||
$query = "DELETE t1"
|
||||
. "\n FROM #__sportsmanager_teamspiel t1"
|
||||
. "\n INNER JOIN #__sportsmanager_teamspiel t2"
|
||||
. "\n ON t1.begegnung_id = t2.begegnung_id"
|
||||
. "\n AND t1.teamspiel_nummer = t2.teamspiel_nummer"
|
||||
. "\n AND t1.teamspiel_id < t2.teamspiel_id"
|
||||
. "\n WHERE t1.begegnung_id = $id;";
|
||||
|
||||
$db->setQuery($query);
|
||||
|
||||
if (!$db->execute()) {
|
||||
abortWithError($db->stderr(true));
|
||||
}
|
||||
|
||||
// Nur Historie eintragen, wenn Datensätze gelöscht wurden
|
||||
$deleted = $db->getAffectedRows();
|
||||
if ($deleted > 0) {
|
||||
|
||||
// Historie eintragen; team_id und user_id auf NULL, wenn nicht vorhanden
|
||||
$query = "INSERT INTO #__sportsmanager_begegnung_historie"
|
||||
. "\n (begegnung_historie_id, begegnung_id, aktion, team_id, user_id, eingetragen)"
|
||||
. "\n VALUES (NULL, $id, 13, NULL, NULL, NOW());";
|
||||
|
||||
$db->setQuery($query);
|
||||
if (!$db->execute()) {
|
||||
abortWithError($db->stderr(true));
|
||||
}
|
||||
}
|
||||
|
||||
// Benachrichtigung schreiben
|
||||
$heim_team = null;
|
||||
@@ -11069,7 +11099,7 @@ function adminDeleteMatchReportBegegnung($id): void
|
||||
abortWithError($db->stderr(true));
|
||||
}
|
||||
|
||||
$query = "DELETE FROM #__sportsmanager_begegnung_historie WHERE begegnung_id = $id AND aktion IN (6,7,8,9,10);";
|
||||
$query = "DELETE FROM #__sportsmanager_begegnung_historie WHERE begegnung_id = $id AND aktion IN (6,7,8,9,10,13);";
|
||||
$db->setQuery($query);
|
||||
if (!$db->execute()) {
|
||||
abortWithError($db->stderr(true));
|
||||
|
||||
@@ -11476,6 +11476,7 @@ static function adminVerbandsorganMitglieder($rows,$verbandsorgan): void
|
||||
10 => Text::_('COM_SPORTSMANAGER_REJECTED_SHIFT'),
|
||||
11 => Text::_('COM_SPORTSMANAGER_SWAP_MATCH'),
|
||||
12 => Text::_('COM_SPORTSMANAGER_MATCH_REPORT_DELETED'),
|
||||
13 => Text::_('COM_SPORTSMANAGER_MATCH_REPORT_CORRECTED'),
|
||||
default => Text::_('COM_SPORTSMANAGER_PROPOSED_APPOINTMENT'),
|
||||
};
|
||||
?>
|
||||
|
||||
@@ -1097,4 +1097,5 @@ COM_SPORTSMANAGER_REALLY_SWAP_MATCH="Willst Du wirklich das Heimrecht tauschen?"
|
||||
COM_SPORTSMANAGER_SWAP_MATCH="Heimrechttausch"
|
||||
COM_SPORTSMANAGER_REALLY_DELETE_MATCH_REPORT="Der Spielbericht wird zusammen mit allen historischen Einträgen gelöscht. Willst du den Spielbericht wirklich löschen?"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_DELETED="Spielbericht gelöscht"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="Der Spielbericht wurde erfolgreich gelöscht!"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="Der Spielbericht wurde erfolgreich gelöscht!"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_CORRECTED="Spielberichtskorrektur"
|
||||
@@ -1097,4 +1097,5 @@ COM_SPORTSMANAGER_REALLY_SWAP_MATCH="Do you really want to swap the home advanta
|
||||
COM_SPORTSMANAGER_SWAP_MATCH="Swap home advantage"
|
||||
COM_SPORTSMANAGER_REALLY_DELETE_MATCH_REPORT="The match report and all its history will be deleted. Are you sure you want to delete the match report?"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_DELETED="Match report deleted"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="The match report has been successfully deleted!"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="The match report has been successfully deleted!"
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_CORRECTED="Match report corrected"
|
||||
Reference in New Issue
Block a user