fix user preference activity

This commit is contained in:
Jean-Christian Paul Denis 2023-04-21 00:29:27 +02:00
parent 5ffa8525a1
commit 2c6764c95c
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
3 changed files with 16 additions and 13 deletions

View File

@ -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['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['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['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 deletion'] = 'Suppression d\'utilisateur';
L10n::$locales['User named "%s" has been deleted by "%"'] = 'L\'utilisateur nommé "%s" a été supprimé par "%s"'; L10n::$locales['User named "%s" has been deleted by "%"'] = 'L\'utilisateur nommé "%s" a été supprimé par "%s"';
L10n::$locales['HTML'] = 'HTML'; L10n::$locales['HTML'] = 'HTML';

View File

@ -1,6 +1,6 @@
# Language: Français # Language: Français
# Module: activityReport - 3.0 # Module: activityReport - 3.0
# Date: 2023-04-20 12:38:46 # Date: 2023-04-20 22:27:38
# Author: , contact@jcdenis.fr # Author: , contact@jcdenis.fr
# Translated with translater 2023.03.19 # Translated with translater 2023.03.19
@ -9,7 +9,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: activityReport 3.0\n" "Project-Id-Version: activityReport 3.0\n"
"POT-Creation-Date: \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" "Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -157,8 +157,8 @@ msgid "updating user preference"
msgstr "Mise à jour de préférence" msgstr "Mise à jour de préférence"
#: src/ActivityBehaviors.php:195 #: src/ActivityBehaviors.php:195
msgid "User named \"%s\" preference has been updated by \"%s\"" msgid "\"%s\" user preference has been updated"
msgstr "L'utilisateur \"%s\" a mis à jour les préférences de \"%s\"" msgstr "Les préférences utilisateur de \"%s\" ont été mis à jour"
#: src/ActivityBehaviors.php:217 #: src/ActivityBehaviors.php:217
msgid "user deletion" msgid "user deletion"

View File

@ -192,21 +192,21 @@ class ActivityBehaviors
$user->add(new Action( $user->add(new Action(
'preference', 'preference',
__('updating user preference'), __('updating user preference'),
__('User named "%s" preference has been updated by "%s"'), __('"%s" user preference has been updated'),
'adminAfterUserProfileUpdate', 'adminAfterUserProfileUpdate',
[self::class, 'userPreference'] [self::class, 'userPreference']
)); ));
$user->add(new Action( $user->add(new Action(
'preference', 'preference',
__('updating user preference'), __('updating user preference'),
__('User named "%s" preference has been updated by "%s"'), __('"%s" user preference has been updated'),
'adminAfterUserOptionsUpdate', 'adminAfterUserOptionsUpdate',
[self::class, 'userPreference'] [self::class, 'userPreference']
)); ));
$user->add(new Action( $user->add(new Action(
'preference', 'preference',
__('updating user preference'), __('updating user preference'),
__('User named "%s" preference has been updated by "%s"'), __('"%s" user preference has been updated'),
'adminAfterDashboardOptionsUpdate', 'adminAfterDashboardOptionsUpdate',
[self::class, 'userPreference'] [self::class, 'userPreference']
)); ));
@ -448,15 +448,18 @@ class ActivityBehaviors
public static function userPreference(cursor $cur, string $user_id): void public static function userPreference(cursor $cur, string $user_id): void
{ {
$user = dcCore::app()->getUser($user_id);
if ($user->isEmpty()) {
return;
}
$user_cn = dcUtils::getUserCN( $user_cn = dcUtils::getUserCN(
$cur->getField('user_id'), $user->f('user_id'),
$cur->getField('user_name'), $user->f('user_name'),
$cur->getField('user_firstname'), $user->f('user_firstname'),
$cur->getField('user_displayname') $user->f('user_displayname')
); );
$logs = [ $logs = [
(string) $user_cn, (string) $user_cn,
(string) dcCore::app()->auth?->getInfo('user_cn'),
]; ];
ActivityReport::instance()->addLog('user', 'preference', $logs); ActivityReport::instance()->addLog('user', 'preference', $logs);
} }