From 0500aec7c77837eaad6a97bce0711a90c8bc22f0 Mon Sep 17 00:00:00 2001 From: jf-cbd Date: Wed, 10 Jun 2026 16:08:48 +0200 Subject: [PATCH] Check if class UserToken exists --- dictionaries/en.dictionary.itop.core.php | 15 ++++++++------- .../Users/ITopUserCountingRepositoryTest.php | 12 +++++++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dictionaries/en.dictionary.itop.core.php b/dictionaries/en.dictionary.itop.core.php index e2914affa..908678fd0 100644 --- a/dictionaries/en.dictionary.itop.core.php +++ b/dictionaries/en.dictionary.itop.core.php @@ -217,13 +217,14 @@ Operators:
'Core:Context=CRON' => 'cron', 'Core:Context=GUI:Portal' => 'Portal', - 'Core:GetCountingUsers:Error' => 'Error while getting %1$s quota', - 'Core:ConsoleUsers' => 'console users', - 'Core:DisabledUsers' => 'disabled users', - 'Core:PortalUsers' => 'portal users', - 'Core:BusinessPartnerUser' => 'business partner users', - 'Core:ReadOnlyUsers' => 'read-only users', - 'Core:ApplicationUsers' => 'application users', + 'Core:GetCountingUsers:Error' => 'Error while counting %1$s', + 'Core:CountingUsers:ConsoleUsers' => 'console users', + 'Core:CountingUsers:DisabledUsers' => 'disabled users', + 'Core:CountingUsers:PortalUsers' => 'portal users', + 'Core:CountingUsers:BusinessPartnerUser' => 'business partner users', + 'Core:CountingUsers:ReadOnlyUsers' => 'read - only users', + 'Core:CountingUsers:ApplicationUsers' => 'application users', + 'Core:CountingUsers:AllUsers' => 'all users', ]); ////////////////////////////////////////////////////////////////////// diff --git a/tests/php-unit-tests/unitary-tests/sources/Users/ITopUserCountingRepositoryTest.php b/tests/php-unit-tests/unitary-tests/sources/Users/ITopUserCountingRepositoryTest.php index 117296c5b..4c0c01138 100644 --- a/tests/php-unit-tests/unitary-tests/sources/Users/ITopUserCountingRepositoryTest.php +++ b/tests/php-unit-tests/unitary-tests/sources/Users/ITopUserCountingRepositoryTest.php @@ -94,9 +94,11 @@ class ITopUserCountingRepositoryTest extends ItopDataTestCase 'portal' => $oITopUserRepository->GetPortalUsers(), 'disabled' => $oITopUserRepository->GetDisabledUsers(), 'readonly' => $oITopUserRepository->GetReadOnlyUsers(), - 'application' => $oITopUserRepository->GetApplicationUsers(), 'businesspartner' => $oITopUserRepository->GetBusinessPartnerUsers(), ]; + if (MetaModel::IsValidClass('UserToken')) { + $aCountedUsers['application'] = $oITopUserRepository->GetApplicationUsers(); + } $aCountedUserFormated = []; foreach ($aCountedUsers as $sCountedCategory => $aUsers) { @@ -129,7 +131,9 @@ class ITopUserCountingRepositoryTest extends ItopDataTestCase $aPortalUsers = $oITopUserRepository->GetPortalUsers(); $aDisabledUsers = $oITopUserRepository->GetDisabledUsers(); $aReadOnlyUsers = $oITopUserRepository->GetReadOnlyUsers(); - $aApplicationUsers = $oITopUserRepository->GetApplicationUsers(); + if (MetaModel::IsValidClass('UserToken')) { + $aApplicationUsers = $oITopUserRepository->GetApplicationUsers() ?? []; + } $aBusinessPartnerUsers = $oITopUserRepository->GetBusinessPartnerUsers(); $aAllUsersFromMergedCounts = array_merge($aConsoleUsers, $aPortalUsers, $aDisabledUsers, $aReadOnlyUsers, $aApplicationUsers, $aBusinessPartnerUsers); @@ -174,7 +178,9 @@ class ITopUserCountingRepositoryTest extends ItopDataTestCase $aPortalUsers = $oITopUserRepository->GetPortalUsers(); $aDisabledUsers = $oITopUserRepository->GetDisabledUsers(); $aReadOnlyUsers = $oITopUserRepository->GetReadOnlyUsers(); - $aApplicationUsers = $oITopUserRepository->GetApplicationUsers(); + if (MetaModel::IsValidClass('UserToken')) { + $aApplicationUsers = $oITopUserRepository->GetApplicationUsers() ?? []; + } $aBusinessPartnerUsers = $oITopUserRepository->GetBusinessPartnerUsers(); $aCountedUsers = array_merge($aConsoleUsers, $aPortalUsers, $aDisabledUsers, $aReadOnlyUsers, $aApplicationUsers, $aBusinessPartnerUsers);