diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 840f501ba61..28947147204 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -42,6 +42,7 @@ $action=$_POST["action"]; $eventstolog=array( array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1), + array('id'=>'USER_LOGOUT', 'test'=>1), array('id'=>'USER_CREATE', 'test'=>1), array('id'=>'USER_MODIFY', 'test'=>1), array('id'=>'USER_NEW_PASSWORD', 'test'=>1), diff --git a/htdocs/includes/triggers/interface_all_Logevents.class.php b/htdocs/includes/triggers/interface_all_Logevents.class.php index 62b92f1e449..53406f25602 100644 --- a/htdocs/includes/triggers/interface_all_Logevents.class.php +++ b/htdocs/includes/triggers/interface_all_Logevents.class.php @@ -40,8 +40,8 @@ class InterfaceLogevents var $desc; /** - * \brief Constructeur. - * \param DB Handler d'acces base + * Constructor. + * @param DB Database handler access */ function InterfaceLogevents($DB) { @@ -107,14 +107,15 @@ class InterfaceLogevents if (empty($conf->entity)) $conf->entity = $entity; // forcing of the entity if it's not defined (ex: in login form) + $this->date=gmmktime(); + $this->duree=0; + // Actions if ($action == 'USER_LOGIN') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte="(UserLogged,".$object->login.")"; $this->desc="(UserLogged,".$object->login.")"; } @@ -123,19 +124,23 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$object->trigger_mesg; // Message direct $this->desc=$object->trigger_mesg; // Message direct } + if ($action == 'USER_LOGOUT') + { + dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); + + // Initialisation donnees (date,duree,texte,desc) + $this->texte="(UserLogoff,".$object->login.")"; + $this->desc="(UserLogoff,".$object->login.")"; + } if ($action == 'USER_CREATE') { dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("NewUserCreated",$object->login); $this->desc=$langs->transnoentities("NewUserCreated",$object->login); } @@ -145,8 +150,6 @@ class InterfaceLogevents $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("EventUserModified",$object->login); $this->desc=$langs->transnoentities("EventUserModified",$object->login); } @@ -156,8 +159,6 @@ class InterfaceLogevents $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("NewUserPassword",$object->login); $this->desc=$langs->transnoentities("NewUserPassword",$object->login); } @@ -166,8 +167,6 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; if ($object->statut == 0) { $this->texte=$langs->transnoentities("UserEnabled",$object->login); @@ -184,8 +183,6 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("UserDeleted",$object->login); $this->desc=$langs->transnoentities("Userdeleted",$object->login); } @@ -196,8 +193,6 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("NewGroupCreated",$object->nom); $this->desc=$langs->transnoentities("NewGroupCreated",$object->nom); } @@ -206,8 +201,6 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("GroupModified",$object->nom); $this->desc=$langs->transnoentities("GroupModified",$object->nom); } @@ -216,8 +209,6 @@ class InterfaceLogevents dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $langs->load("users"); // Initialisation donnees (date,duree,texte,desc) - $this->date=gmmktime(); - $this->duree=0; $this->texte=$langs->transnoentities("GroupDeleted",$object->nom); $this->desc=$langs->transnoentities("GroupDeleted",$object->nom); } diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 50f0bd01d77..2fe06c3630f 100755 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -92,7 +92,8 @@ InternalExternalDesc=An internal user is a user that is part of your comp PermissionInheritedFromAGroup=Permission granted because inherited from one of a user's group. Inherited=Inherited IdPhoneCaller=Id phone caller -UserLogged=User %s connected +UserLogged=User %s login +UserLogoff=User %s logout NewUserCreated=User %s created NewUserPassword=Password change for %s EventUserModified=User %s modified diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang index 1ef9a7a40e2..d29b27ecd71 100755 --- a/htdocs/langs/fr_FR/users.lang +++ b/htdocs/langs/fr_FR/users.lang @@ -93,6 +93,7 @@ PermissionInheritedFromAGroup=La permission est accordée car héritée d'un gro Inherited=Hérité IdPhoneCaller=Id appelant (téléphone) UserLogged=Connexion utilisateur %s +UserLogoff=Déconnexion utilisateur %s NewUserCreated=Création utilisateur %s NewUserPassword=Changement mot de passe de %s EventUserModified=Modification utilisateur %s