From 97eafcc5d0637d0872b5438f72a46f40c1e330d6 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 30 Nov 2023 14:26:11 +0100 Subject: [PATCH] count valid roles --- core/module/course/course.php | 8 ++++++-- core/module/user/user.php | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/module/course/course.php b/core/module/course/course.php index 829acde..797d0b9 100644 --- a/core/module/course/course.php +++ b/core/module/course/course.php @@ -624,7 +624,9 @@ class course extends common foreach ($users as $userId => $userValue) { // Compte les rôles - $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) { + $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + } // Filtres if ( @@ -769,7 +771,9 @@ class course extends common foreach ($users as $userId => $userValue) { // Compte les rôles - $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) { + $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + } // Filtres if ( diff --git a/core/module/user/user.php b/core/module/user/user.php index aeadba1..1449006 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -483,7 +483,9 @@ class user extends common if ($this->getData(['user', $userId, 'group'])) { // Compte les rôles - $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) { + $profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++; + } // Filtres if ($this->isPost()) {