From 61d5af0651a20c32a0e0f1ab0e3140bcc6f14acf Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Fri, 24 Jan 2020 11:13:11 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20de=20bugs=20concernant=20les=20cla?= =?UTF-8?q?sses=20et=20=C3=A9coles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server_files/classes/User.php | 2 +- server_files/controllers/inscription.php | 3 +++ server_files/controllers/mon_compte.php | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server_files/classes/User.php b/server_files/classes/User.php index 381e71c..b069b97 100644 --- a/server_files/classes/User.php +++ b/server_files/classes/User.php @@ -300,7 +300,7 @@ class User { global $DB; $this->school = $school; - $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([SchoolClass::getName($school), $this->getId()]); + $DB->prepare("UPDATE `users` SET `school` = ? WHERE `id` = ?;")->execute([$school, $this->getId()]); } public function getClass() diff --git a/server_files/controllers/inscription.php b/server_files/controllers/inscription.php index 62917e3..99adfe4 100644 --- a/server_files/controllers/inscription.php +++ b/server_files/controllers/inscription.php @@ -72,6 +72,9 @@ class NewUser ensure(filter_var($this->responsible_email, FILTER_VALIDATE_EMAIL), "Veuillez spécifier un responsable légal."); } } + else { + $this->class = SchoolClass::ADULT; + } if (count(User::getAllUsers()) == 0) $this->role = Role::ADMIN; diff --git a/server_files/controllers/mon_compte.php b/server_files/controllers/mon_compte.php index 219ded5..fa1b762 100644 --- a/server_files/controllers/mon_compte.php +++ b/server_files/controllers/mon_compte.php @@ -83,7 +83,7 @@ class MyAccount $keys = ["email", "surname", "first_name", "birth_date", "gender", "address", "postal_code", "city", "country", "phone_number", "school", "class", "responsible_name", "responsible_phone", "responsible_email", "description"]; - if ($this->user->getRole() != Role::PARTICIPANT) + if ($this->user->getRole() == Role::PARTICIPANT) $this->class = SchoolClass::fromName(strtoupper($this->class)); else $this->class = SchoolClass::ADULT;