From 5b7ddb265302608260f54ba44dc3bca0f3f52441 Mon Sep 17 00:00:00 2001 From: CamilleBeau <51176779+CamilleBeau@users.noreply.github.com> Date: Tue, 12 Dec 2023 13:08:10 -0500 Subject: [PATCH] [libraries] Get examiner sites by UserID (#8994) Fix bug where if a user has the same full name as another user, the examiner sites from the other user will show up in the edit user page. --- php/libraries/User.class.inc | 4 ++-- test/unittests/UserTest.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/php/libraries/User.class.inc b/php/libraries/User.class.inc index f41bbea209f..46a5a3dba8b 100644 --- a/php/libraries/User.class.inc +++ b/php/libraries/User.class.inc @@ -122,12 +122,12 @@ class User extends UserPermissions implements epr.pending_approval FROM examiners e JOIN examiners_psc_rel epr ON (e.examinerID=epr.examinerID) - WHERE e.full_name=:fn + WHERE e.userID=:uid AND (epr.active='Y' OR (epr.active='N' AND epr.pending_approval='Y') )", [ - "fn" => $row['Real_name'], + "uid" => $row['ID'], ] ); diff --git a/test/unittests/UserTest.php b/test/unittests/UserTest.php index 1a57b15ad1c..5101543117a 100644 --- a/test/unittests/UserTest.php +++ b/test/unittests/UserTest.php @@ -105,6 +105,7 @@ class UserTest extends TestCase * @var array */ private $_examinerInfo = [0 => ['full_name' => 'John Doe', + 'userID' => '1', 'examinerID' => 1, 'radiologist' => 1 ]