mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-24 17:02:24 +00:00
Validation des paiements faites par les admins
This commit is contained in:
parent
b86675ba98
commit
606ad5886f
@ -101,6 +101,22 @@ class User
|
||||
return $admins;
|
||||
}
|
||||
|
||||
public static function getAdmins()
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$users = [];
|
||||
$req = $DB->query("SELECT * FROM `users` WHERE (`role` = 'ADMIN') "
|
||||
. "AND `year` = $YEAR ORDER BY `role`, `inscription_date`;");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$orphan = new User();
|
||||
$orphan->fill($data);
|
||||
$users[] = $orphan;
|
||||
}
|
||||
|
||||
return $users;
|
||||
}
|
||||
|
||||
public static function getAllUsers()
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
|
@ -46,13 +46,13 @@ class Pay {
|
||||
|
||||
ensure($payment->getValidationStatus() == ValidationStatus::NOT_READY, "Un paiement est déjà initié.");
|
||||
ensure($this->method != PaymentMethod::NOT_PAID, "Vous n'avez pas payé.");
|
||||
ensure($this->method == PaymentMethod::SCHOLARSHIP || ($this->infos != null && sizeof($this->infos) > 0), "Merci d'indiquer des informations pour retrouver votre paiement.");
|
||||
ensure($this->method == PaymentMethod::SCHOLARSHIP || ($this->infos != null && strlen($this->infos) > 0), "Merci d'indiquer des informations pour retrouver votre paiement.");
|
||||
ensure($this->method != PaymentMethod::SCHOLARSHIP || ($this->scholarship != null && !$this->scholarship["error"]), "Si vous êtes boursier, vous devez indiquer votre notifcation de bourse (une erreur est survenue).");
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
global $DB, $LOCAL_PATH, $payment, $tournament;
|
||||
global $DB, $LOCAL_PATH, $payment, $user, $team, $tournament;
|
||||
|
||||
$payment->setMethod($this->method);
|
||||
$payment->setAmount($this->method == PaymentMethod::SCHOLARSHIP ? 0 : $tournament->getPrice());
|
||||
@ -72,6 +72,8 @@ class Pay {
|
||||
}
|
||||
else
|
||||
$payment->setTransactionInfos($this->infos);
|
||||
|
||||
Mailer::requestPaymentValidation($user, $team, $tournament, $payment);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -135,6 +135,7 @@ class Mailer
|
||||
$content = self::getTemplate("request_payment_validation");
|
||||
$content = preg_replace("#{USER_FIRST_NAME}#", $user->getFirstName(), $content);
|
||||
$content = preg_replace("#{USER_SURNAME}#", $user->getSurname(), $content);
|
||||
$content = preg_replace("#{USER_ID}#", $user->getId(), $content);
|
||||
$content = preg_replace("#{TEAM_NAME}#", $team->getName(), $content);
|
||||
$content = preg_replace("#{TRIGRAM}#", $team->getTrigram(), $content);
|
||||
$content = preg_replace("#{TOURNAMENT_NAME}#", $tournament->getName(), $content);
|
||||
@ -145,7 +146,11 @@ class Mailer
|
||||
else
|
||||
$content = preg_replace("#{PAYMENT_INFOS}#", $payment->getTransactionInfos(), $content);
|
||||
|
||||
self::sendMail($user->getEmail(), "Demande de validation de paiement pour le tournoi " . $tournament->getName() . " – TFJM² $YEAR", $content);
|
||||
foreach (User::getAdmins() as $admin) {
|
||||
$content = preg_replace("#{FIRST_NAME}#", $admin->getFirstName(), $content);
|
||||
$content = preg_replace("#{SURNAME}#", $admin->getSurname(), $content);
|
||||
self::sendMail($admin->getEmail(), "Demande de validation de paiement pour le tournoi " . $tournament->getName() . " – TFJM² $YEAR", $content);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sendValidatePayment(User $user, Team $team, Tournament $tournament, Payment $payment, $message)
|
||||
|
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE html>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Demande de validation de paiement pour le TFJM² {YEAR}</title>
|
||||
</head>
|
||||
<body>
|
||||
Bonjour {FIRST_NAME} {SURNAME},<br />
|
||||
<br />
|
||||
{USER_FIRST_NAME} {USER_SURNAME} de l'équipe {TEAM_NAME} ({TRIGRAM}) annonce avoir réglé sa participation pour le tournoi {TOURNAMENT_NAME}.
|
||||
Les informations suivantes ont été communiquées :<br /><br />
|
||||
<strong>Équipe :</strong> {TEAM_NAME} ({TRIGRAM})<br />
|
||||
<strong>Tournoi :</strong> {TOURNAMENT_NAME}<br />
|
||||
<strong>Moyen de paiement :</strong> {PAYMENT_METHOD}<br />
|
||||
<strong>Montant :</strong> {AMOUNT} €<br />
|
||||
<strong>Informations sur le paiement :</strong> {PAYMENT_INFOS}<br />
|
||||
<br />
|
||||
Vous pouvez désormais vérifier ces informations, puis valider (ou non) le paiement sur
|
||||
<a href="{URL_BASE}/informations/{USER_ID}/">la page associée à ce participant</a>.
|
||||
<br />
|
||||
Cordialement,
|
||||
<br />
|
||||
Le comité national d'organisation du TFJM<sup>2</sup>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user