mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-26 05:57:39 +02:00
Page de paiement (en cours)
This commit is contained in:
@ -422,6 +422,22 @@ class User
|
||||
return $docs;
|
||||
}
|
||||
|
||||
public function getPayment() {
|
||||
global $DB;
|
||||
|
||||
$team = Team::fromId($this->team_id);
|
||||
$tournament = $team->getEffectiveTournament();
|
||||
|
||||
$req = $DB->prepare("SELECT `id` FROM `payments` WHERE `user` = ? AND `tournament` = ?;");
|
||||
$req->execute([$this->id, $tournament->getId()]);
|
||||
|
||||
if (($data = $req->fetch()) !== false)
|
||||
return Payment::fromId($data["id"]);
|
||||
|
||||
$req = $DB->prepare("INSERT INTO `payments`(`user`, `tournament`, `amount`, `method`, `transaction_infos`, `validation_status`) VALUES (?, ?, ?, ?, ?, ?);");
|
||||
$req->execute([$this->id, $tournament->getId(), 0, PaymentMethod::getName(PaymentMethod::NOT_PAID), "L'inscription n'est pas encore payée.", ValidationStatus::getName(ValidationStatus::NOT_READY)]);
|
||||
}
|
||||
|
||||
public function getOrganizedTournaments()
|
||||
{
|
||||
global $DB;
|
||||
|
Reference in New Issue
Block a user