mirror of
https://github.com/Deutscher-Tischfussballbund/com_sportsmanager.git
synced 2026-09-11 18:41:50 +00:00
Exception Fehler bei E-Mail Versand
This commit is contained in:
@@ -7061,14 +7061,17 @@ function sendJoomlaMail(): void
|
||||
$mailer->isHtml(true);
|
||||
|
||||
// Senden
|
||||
try {
|
||||
$result = $mailer->send();
|
||||
|
||||
//return ($result === true) ? true : 'Fehler beim Versand: ' . $result->__toString();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der E-Mail: ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$result = false;
|
||||
}
|
||||
|
||||
if ($result === true)
|
||||
redirectSportsManagerURL('&task=' . $back, Text::_('COM_SPORTSMANAGER_EMAIL_WAS_SEND'));
|
||||
else
|
||||
redirectSportsManagerURL('&task=' . $back, Text::_('COM_SPORTSMANAGER_EMAIL_WAS_NOT_SEND'));
|
||||
redirectSportsManagerURL('&task=' . $back, Text::_('COM_SPORTSMANAGER_EMAIL_WAS_NOT_SEND'), 'warning');
|
||||
}
|
||||
|
||||
function adminOrdnungsstrafen(): void
|
||||
@@ -11092,6 +11095,7 @@ function adminSaveBegegnungSpielplan(): void
|
||||
$gast_team = $rows[0];
|
||||
}
|
||||
|
||||
$mail_fehler = '';
|
||||
if ($bestaetigen != 0 && !$zwischenergebnis) {
|
||||
$mailfrom = $app->getCfg('mailfrom');
|
||||
$fromname = $app->getCfg('fromname');
|
||||
@@ -11108,7 +11112,12 @@ function adminSaveBegegnungSpielplan(): void
|
||||
foreach ($rows as $row) {
|
||||
$mailer->addBcc($row->email);
|
||||
}
|
||||
try {
|
||||
$mailer->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der Ergebnis-Mail: ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$mail_fehler = Text::_('COM_SPORTSMANAGER_MAIL_SEND_ERROR');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11130,19 +11139,19 @@ function adminSaveBegegnungSpielplan(): void
|
||||
begegnungSpielplan();
|
||||
} else {
|
||||
if ($erneut_oeffnen) {
|
||||
redirectSportsManagerURL('&task=' . ($bestaetigen != 0 ? ($bestaetigen == 1 ? 'admin_begegnung_spielplan_edit_bestaetigen' : 'pineingabe') : 'admin_begegnung_spielplan_edit') . '&id=' . $id . '&veranstaltungid=' . $veranstaltungId . ($bestaetigen != 0 ? '_bestaetigen' : '') . '&veranstaltungid=' . $veranstaltungId . '&id=' . $id . '&erneut_oeffnen=1' . (!empty($encrypted_pin) ? ('&epin=' . $encrypted_pin) : "") . ($aus_uebersicht ? '&aus_uebersicht=1' : ''));
|
||||
redirectSportsManagerURL('&task=' . ($bestaetigen != 0 ? ($bestaetigen == 1 ? 'admin_begegnung_spielplan_edit_bestaetigen' : 'pineingabe') : 'admin_begegnung_spielplan_edit') . '&id=' . $id . '&veranstaltungid=' . $veranstaltungId . ($bestaetigen != 0 ? '_bestaetigen' : '') . '&veranstaltungid=' . $veranstaltungId . '&id=' . $id . '&erneut_oeffnen=1' . (!empty($encrypted_pin) ? ('&epin=' . $encrypted_pin) : "") . ($aus_uebersicht ? '&aus_uebersicht=1' : ''), $mail_fehler, 'warning');
|
||||
} else if ($bestaetigen == 1) {
|
||||
if ($aus_uebersicht)
|
||||
redirectSportsManagerURL('#id' . $id);
|
||||
redirectSportsManagerURL('#id' . $id, $mail_fehler, 'warning');
|
||||
else
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId . '#id' . $id);
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId . '#id' . $id, $mail_fehler, 'warning');
|
||||
} else if ($bestaetigen == 2) {
|
||||
if ($aus_uebersicht)
|
||||
redirectSportsManagerURL();
|
||||
redirectSportsManagerURL(NULL, $mail_fehler, 'warning');
|
||||
else
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId);
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId, $mail_fehler, 'warning');
|
||||
} else {
|
||||
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=' . $veranstaltungId . '#id' . $id);
|
||||
redirectSportsManagerURL('&task=admin_begegnungen&veranstaltungid=' . $veranstaltungId . '#id' . $id, $mail_fehler, 'warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11463,6 +11472,7 @@ function adminBegegnungSpielplanBestaetigen(): void
|
||||
$subject = $heim_team->teamname . " vs. " . $gast_team->teamname . ": Ergebnis akzeptiert";
|
||||
$body = "Zur Begegnung " . $heim_team->teamname . " gegen " . $gast_team->teamname . " am " . FormatiertesDatum($begegnung->zeitpunkt) . " in der " . $veranstaltung->bezeichnung . " wurde von " . ($aktion_team_id == $heim_team->team_id ? $heim_team->teamname : $gast_team->teamname) . " das Ergebnis akzeptiert.";
|
||||
|
||||
$mail_fehler = '';
|
||||
$query = "SELECT * FROM #__users AS t1, #__sportsmanager_berechtigt_fuer_team AS t2 WHERE t1.id = t2.berechtigt_user_id AND (t2.berechtigt_team_id = " . $begegnung->heim_team_id . " OR t2.berechtigt_team_id = " . $begegnung->gast_team_id . ")";
|
||||
$rows = loadObjectList($db, $query);
|
||||
if(!empty($rows)) {
|
||||
@@ -11473,16 +11483,21 @@ function adminBegegnungSpielplanBestaetigen(): void
|
||||
foreach ($rows as $row) {
|
||||
$mailer->addBcc($row->email);
|
||||
}
|
||||
try {
|
||||
$mailer->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der Ergebnis-Mail: ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$mail_fehler = Text::_('COM_SPORTSMANAGER_MAIL_SEND_ERROR');
|
||||
}
|
||||
}
|
||||
|
||||
if (isJson()) {
|
||||
begegnungSpielplan();
|
||||
} else {
|
||||
if ($aus_uebersicht) {
|
||||
redirectSportsManagerURL('#id' . $id);
|
||||
redirectSportsManagerURL('#id' . $id, $mail_fehler, 'warning');
|
||||
} else {
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId . '#id' . $id);
|
||||
redirectSportsManagerURL('&task=veranstaltung&veranstaltungid=' . $veranstaltungId . '#id' . $id, $mail_fehler, 'warning');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17557,12 +17572,15 @@ function adminSaveTermin($admin_uebersicht): void
|
||||
}
|
||||
$termin_aktion_id = $db->insertid();
|
||||
|
||||
termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten);
|
||||
$mail_erfolg = termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten);
|
||||
|
||||
if ($zugriffsebene == 1) {
|
||||
if (!$mail_erfolg) {
|
||||
Factory::getContainer()->get(SiteApplication::class)->enqueueMessage(Text::_('COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR'), 'warning');
|
||||
}
|
||||
HTML_sportsmanager_admin::adminTermineBeantragtBestaetigung($admin_uebersicht);
|
||||
} else {
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . ($uebersicht ? 'termine' : 'termine_verlauf') . ($nur_beantragte ? '&nur_beantragte=1' : ''));
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . ($uebersicht ? 'termine' : 'termine_verlauf') . ($nur_beantragte ? '&nur_beantragte=1' : ''), $mail_erfolg ? '' : Text::_('COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR'), 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17685,12 +17703,15 @@ function adminRemoveTermin($admin_uebersicht): void
|
||||
}
|
||||
$termin_aktion_id = $db->insertid();
|
||||
|
||||
termineEmailBenachrichtigung($termin_aktion_id);
|
||||
$mail_erfolg = termineEmailBenachrichtigung($termin_aktion_id);
|
||||
|
||||
if ($zugriffsebene == 1) {
|
||||
if (!$mail_erfolg) {
|
||||
Factory::getContainer()->get(SiteApplication::class)->enqueueMessage(Text::_('COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR'), 'warning');
|
||||
}
|
||||
HTML_sportsmanager_admin::adminTermineBeantragtBestaetigung($admin_uebersicht);
|
||||
} else {
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . 'termine');
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . 'termine', $mail_erfolg ? '' : Text::_('COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR'), 'warning');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17867,6 +17888,7 @@ function termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten = false)
|
||||
$body = "<p>Das " . htmlentities_utf8($aktion[$terminaktion->typ]) . " des folgenden Termins wurde " . ($terminaktion->status == 0 ? ($ueberarbeiten ? "in überarbeiteter Form akzeptiert" : "akzeptiert") : "abgelehnt") . ".</p>";
|
||||
}
|
||||
$body .= "<table>\r\n" . $termin_beschreibung . $termin_moderationsstatus . "</table>\r\n";
|
||||
$erfolg = true;
|
||||
if(!empty($benachrichtigung_emails)) {
|
||||
$mailer = Factory::getContainer()->get(MailerFactoryInterface::class)->createMailer();
|
||||
$mailer->setSender($from, $fromName);
|
||||
@@ -17875,7 +17897,12 @@ function termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten = false)
|
||||
$mailer->setBody($body);
|
||||
foreach ($benachrichtigung_emails as $email)
|
||||
$mailer->addBcc($email);
|
||||
try {
|
||||
$mailer->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der Termin-Benachrichtigung (Antragsteller): ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$erfolg = false;
|
||||
}
|
||||
}
|
||||
|
||||
$from = $app->getCfg('mailfrom');
|
||||
@@ -17899,7 +17926,12 @@ function termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten = false)
|
||||
$mailer->setBody($body);
|
||||
foreach ($benachrichtigung_moderatoren_informieren as $email)
|
||||
$mailer->addBcc($email);
|
||||
try {
|
||||
$mailer->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der Termin-Benachrichtigung (Moderatoren informieren): ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$erfolg = false;
|
||||
}
|
||||
}
|
||||
|
||||
$body .= "<p>Bitte <a href=\"" . SportsManagerURL('&task=admin_termin_details&nur_beantragte=1&id=' . $terminaktion->termin_aktion_id, -1) . "\">hier</a> klicken, um den Termin zu moderieren.</p>\r\n";
|
||||
@@ -17911,10 +17943,15 @@ function termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten = false)
|
||||
$mailer->setBody($body);
|
||||
foreach ($benachrichtigung_moderatoren_aendern as $email)
|
||||
$mailer->addBcc($email);
|
||||
try {
|
||||
$mailer->send();
|
||||
} catch (\Exception $e) {
|
||||
Log::add('Fehler beim Versenden der Termin-Benachrichtigung (Moderatoren ändern): ' . $e->getMessage(), Log::WARNING, 'com_sportsmanager');
|
||||
$erfolg = false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return $erfolg;
|
||||
}
|
||||
|
||||
#[NoReturn] function adminTerminModerieren($admin_uebersicht): void
|
||||
@@ -18003,9 +18040,9 @@ function termineEmailBenachrichtigung($termin_aktion_id, $ueberarbeiten = false)
|
||||
die($db->stderr(true));
|
||||
}
|
||||
|
||||
termineEmailBenachrichtigung($id);
|
||||
$mail_erfolg = termineEmailBenachrichtigung($id);
|
||||
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . ($uebersicht ? 'termine' : 'termine_verlauf') . ($nur_beantragte ? '&nur_beantragte=1' : ''));
|
||||
redirectSportsManagerURL('&task=' . ($admin_uebersicht ? 'admin_' : '') . ($uebersicht ? 'termine' : 'termine_verlauf') . ($nur_beantragte ? '&nur_beantragte=1' : ''), $mail_erfolg ? '' : Text::_('COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR'), 'warning');
|
||||
}
|
||||
|
||||
function adminTermineVerlauf($admin_uebersicht): void
|
||||
|
||||
@@ -1146,7 +1146,7 @@ if ($task == "spielerbild") {
|
||||
|
||||
return;
|
||||
|
||||
#[NoReturn] function redirectSportsManagerURL($weitereParameter = NULL, $nachricht = ''): void
|
||||
#[NoReturn] function redirectSportsManagerURL($weitereParameter = NULL, $nachricht = '', $nachrichtTyp = 'message'): void
|
||||
{
|
||||
global $redirect_session_id;
|
||||
if (!empty($redirect_session_id)) {
|
||||
@@ -1156,7 +1156,7 @@ return;
|
||||
}
|
||||
$app = Factory::getContainer()->get(SiteApplication::class);
|
||||
if ($nachricht != '') {
|
||||
$app->enqueueMessage($nachricht);
|
||||
$app->enqueueMessage($nachricht, $nachrichtTyp);
|
||||
}
|
||||
$app->redirect(SportsManagerURL($weitereParameter), 200);
|
||||
exit;
|
||||
|
||||
@@ -1116,3 +1116,5 @@ COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="Der Spielbericht wurde erfolgreich g
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_CORRECTED="Spielberichtskorrektur"
|
||||
COM_SPORTSMANAGER_MIN_MATCHES="Mindestzahl Spiele"
|
||||
COM_SPORTSMANAGER_SELECT_ALL="Alle"
|
||||
COM_SPORTSMANAGER_MAIL_SEND_ERROR="Die Benachrichtigungs-E-Mail zum Ergebnis konnte nicht versendet werden."
|
||||
COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR="Mindestens eine Benachrichtigungs-E-Mail zum Termin konnte nicht versendet werden."
|
||||
@@ -1116,3 +1116,5 @@ COM_SPORTSMANAGER_MATCH_REPORT_WAS_DELETED="The match report has been successful
|
||||
COM_SPORTSMANAGER_MATCH_REPORT_CORRECTED="Match report corrected"
|
||||
COM_SPORTSMANAGER_MIN_MATCHES="Min count matches"
|
||||
COM_SPORTSMANAGER_SELECT_ALL="All"
|
||||
COM_SPORTSMANAGER_MAIL_SEND_ERROR="The notification e-mail for the result could not be sent."
|
||||
COM_SPORTSMANAGER_TERMIN_MAIL_SEND_ERROR="At least one notification e-mail for the appointment could not be sent."
|
||||
Reference in New Issue
Block a user