From 2c6764c95cd404b747aa3defe37c3056528895ec Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Fri, 21 Apr 2023 00:29:27 +0200 Subject: [PATCH] fix user preference activity --- locales/fr/main.lang.php | 2 +- locales/fr/main.po | 8 ++++---- src/ActivityBehaviors.php | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/locales/fr/main.lang.php b/locales/fr/main.lang.php index 1e1105a..102d365 100644 --- a/locales/fr/main.lang.php +++ b/locales/fr/main.lang.php @@ -46,7 +46,7 @@ L10n::$locales['A new user named "%s" was created by "%s"'] L10n::$locales['updating user'] = 'Mise à jour d\'utilisateur'; L10n::$locales['User named "%s" has been updated by "%s"'] = 'L\'utilisateur "%s" a été mis à jour par "%s"'; L10n::$locales['updating user preference'] = 'Mise à jour de préférence'; -L10n::$locales['User named "%s" preference has been updated by "%s"'] = 'L\'utilisateur "%s" a mis à jour les préférences de "%s"'; +L10n::$locales['"%s" user preference has been updated'] = 'Les préférences utilisateur de "%s" ont été mis à jour'; L10n::$locales['user deletion'] = 'Suppression d\'utilisateur'; L10n::$locales['User named "%s" has been deleted by "%"'] = 'L\'utilisateur nommé "%s" a été supprimé par "%s"'; L10n::$locales['HTML'] = 'HTML'; diff --git a/locales/fr/main.po b/locales/fr/main.po index 1cb0313..e3512bb 100644 --- a/locales/fr/main.po +++ b/locales/fr/main.po @@ -1,6 +1,6 @@ # Language: Français # Module: activityReport - 3.0 -# Date: 2023-04-20 12:38:46 +# Date: 2023-04-20 22:27:38 # Author: , contact@jcdenis.fr # Translated with translater 2023.03.19 @@ -9,7 +9,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: activityReport 3.0\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2023-04-20T12:38:46+00:00\n" +"PO-Revision-Date: 2023-04-20T22:27:38+00:00\n" "Last-Translator: Jean-Christian Denis\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -157,8 +157,8 @@ msgid "updating user preference" msgstr "Mise à jour de préférence" #: src/ActivityBehaviors.php:195 -msgid "User named \"%s\" preference has been updated by \"%s\"" -msgstr "L'utilisateur \"%s\" a mis à jour les préférences de \"%s\"" +msgid "\"%s\" user preference has been updated" +msgstr "Les préférences utilisateur de \"%s\" ont été mis à jour" #: src/ActivityBehaviors.php:217 msgid "user deletion" diff --git a/src/ActivityBehaviors.php b/src/ActivityBehaviors.php index 6778273..8a76e97 100644 --- a/src/ActivityBehaviors.php +++ b/src/ActivityBehaviors.php @@ -192,21 +192,21 @@ class ActivityBehaviors $user->add(new Action( 'preference', __('updating user preference'), - __('User named "%s" preference has been updated by "%s"'), + __('"%s" user preference has been updated'), 'adminAfterUserProfileUpdate', [self::class, 'userPreference'] )); $user->add(new Action( 'preference', __('updating user preference'), - __('User named "%s" preference has been updated by "%s"'), + __('"%s" user preference has been updated'), 'adminAfterUserOptionsUpdate', [self::class, 'userPreference'] )); $user->add(new Action( 'preference', __('updating user preference'), - __('User named "%s" preference has been updated by "%s"'), + __('"%s" user preference has been updated'), 'adminAfterDashboardOptionsUpdate', [self::class, 'userPreference'] )); @@ -448,15 +448,18 @@ class ActivityBehaviors public static function userPreference(cursor $cur, string $user_id): void { + $user = dcCore::app()->getUser($user_id); + if ($user->isEmpty()) { + return; + } $user_cn = dcUtils::getUserCN( - $cur->getField('user_id'), - $cur->getField('user_name'), - $cur->getField('user_firstname'), - $cur->getField('user_displayname') + $user->f('user_id'), + $user->f('user_name'), + $user->f('user_firstname'), + $user->f('user_displayname') ); $logs = [ (string) $user_cn, - (string) dcCore::app()->auth?->getInfo('user_cn'), ]; ActivityReport::instance()->addLog('user', 'preference', $logs); }