From 75207ea05c558d35e7ee55a56c98a16a4879b7e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Thu, 28 Feb 2008 20:37:04 +0000 Subject: [PATCH] New: Add "Audit" feature. --- htdocs/admin/events.php | 154 ++++++++++++++++++ htdocs/admin/perms.php | 18 +- htdocs/admin/security.php | 23 +-- htdocs/admin/security_other.php | 24 +-- htdocs/{agenda => core}/events.class.php | 36 ++-- htdocs/fourn/facture/paiementfourn.class.php | 10 +- ....php => interface_all_Logevents.class.php} | 39 ++--- htdocs/interfaces.class.php | 4 +- htdocs/langs/en_US/admin.lang | 4 + htdocs/langs/fr_FR/admin.lang | 4 + htdocs/lib/admin.lib.php | 37 +++++ htdocs/paiement.class.php | 4 +- htdocs/user.class.php | 8 +- htdocs/usergroup.class.php | 6 +- mysql/migration/2.2.0-2.4.0.sql | 14 +- mysql/tables/llx_events.sql | 3 +- 16 files changed, 273 insertions(+), 115 deletions(-) create mode 100644 htdocs/admin/events.php rename htdocs/{agenda => core}/events.class.php (92%) rename htdocs/includes/triggers/{interface_modAgenda_Eventsynchro.class.php => interface_all_Logevents.class.php} (94%) diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php new file mode 100644 index 00000000000..e948f4bdb2d --- /dev/null +++ b/htdocs/admin/events.php @@ -0,0 +1,154 @@ +<?php +/* Copyright (C) 2008 Laurent Destailleur <eldy@users.sourceforge.net> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + \file htdocs/admin/events.php + \ingroup core + \brief Log event setup page + \version $Id$ +*/ + +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/agenda.lib.php"); + + +if (!$user->admin) + accessforbidden(); + + +$langs->load("admin"); +$langs->load("other"); + +$action=$_POST["action"]; + +$eventstolog=array( + array('id'=>'ACTION_CREATE', 'test'=>$conf->societe->enabled), + array('id'=>'COMPANY_CREATE', 'test'=>$conf->societe->enabled), + array('id'=>'CONTRACT_VALIDATE', 'test'=>$conf->contrat->enabled), + array('id'=>'CONTRACT_CANCEL', 'test'=>$conf->contrat->enabled), + array('id'=>'CONTRACT_CLOSE', 'test'=>$conf->contrat->enabled), + array('id'=>'PROPAL_VALIDATE', 'test'=>$conf->propal->enabled), + array('id'=>'PROPAL_CLOSE_SIGNED', 'test'=>$conf->propal->enabled), + array('id'=>'PROPAL_CLOSE_REFUSED', 'test'=>$conf->propal->enabled), + array('id'=>'BILL_VALIDATE', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_PAYED', 'test'=>$conf->facture->enabled), + array('id'=>'BILL_CANCELED', 'test'=>$conf->facture->enabled), + array('id'=>'PAYMENT_CUSTOMER_CREATE','test'=>$conf->facture->enabled), + array('id'=>'PAYMENT_SUPPLIER_CREATE','test'=>$conf->fournisseur->enabled), + array('id'=>'MEMBER_VALIDATE', 'test'=>$conf->adherent->enabled), + array('id'=>'MEMBER_SUBSCRIPTION', 'test'=>$conf->adherent->enabled), + array('id'=>'MEMBER_MODIFY', 'test'=>$conf->adherent->enabled), + array('id'=>'MEMBER_RESILIATE', 'test'=>$conf->adherent->enabled), + array('id'=>'MEMBER_DELETE', 'test'=>$conf->adherent->enabled), +); + + +/* +* Actions +*/ +if ($action == "save") +{ + $i=0; + + $db->begin(); + + foreach ($eventstolog as $key => $arr) + { + $param='MAIN_LOGEVENTS_'.$arr['id']; + //print "param=".$param." - ".$_POST[$param]; + if (! empty($_POST[$param])) dolibarr_set_const($db,$param,$_POST[$param],'chaine',0); + else dolibarr_del_const($db,$param); + } + + $db->commit(); + $mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; +} + + + +/** + * Affichage du formulaire de saisie + */ + +llxHeader(); + +//$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; +print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); + +print $langs->trans("LogEventDesc")."<br>\n"; +print "<br>\n"; + +$head=security_prepare_head(); + +dolibarr_fiche_head($head, 'audit', $langs->trans("Security")); + + +print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">'; +print '<input type="hidden" name="action" value="save">'; + +$var=true; +print "<table class=\"noborder\" width=\"100%\">"; +print "<tr class=\"liste_titre\">"; +print "<td colspan=\"2\">".$langs->trans("LogEvents")."</td>"; +print "</tr>\n"; +foreach ($eventstolog as $key => $arr) +{ + if ($arr['id']) + { + $var=!$var; + print '<tr '.$bc[$var].'>'; + print '<td>'.$arr['id'].'</td>'; + print '<td>'; + $key='MAIN_LOGEVENTS_'.$arr['id']; + $value=$conf->global->$key; + print '<input type="checkbox" name="'.$key.'" value="1"'.($value?' checked="true"':'').'>'; + print '</td></tr>'."\n"; + } +} +print '</table>'; + +print '<br><center>'; +print "<input type=\"submit\" name=\"save\" class=\"button\" value=\"".$langs->trans("Save")."\">"; +print "</center>"; + +print "</form>\n"; + +print '</div>'; + + + +if ($mesg) print "<br>$mesg<br>"; +print "<br>"; + +// Show message +/* +$message=''; +$urlwithouturlroot=eregi_replace(DOL_URL_ROOT.'$','',$dolibarr_main_url_root); +$urlvcal='<a href="'.DOL_URL_ROOT.'/webcal/webcalexport.php?format=vcal" target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/webcal/webcalexport.php?format=vcal'.'</a>'; +$message.=$langs->trans("WebCalUrlForVCalExport",'vcal',$urlvcal); +$message.='<br>'; +$urlical='<a href="'.DOL_URL_ROOT.'/webcal/webcalexport.php?format=ical&type=event" target="_blank">'.$urlwithouturlroot.DOL_URL_ROOT.'/webcal/webcalexport.php?format=ical&type=event'.'</a>'; +$message.=$langs->trans("WebCalUrlForVCalExport",'ical',$urlical); +print info_admin($message); +*/ + +$db->close(); + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 0902841bb62..5ecc1b41c3d 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -55,23 +55,9 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print $langs->trans("DefaultRightsDesc")."<br>\n"; print "<br>\n"; +$head=security_prepare_head(); -$h = 0; - -$head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; -$head[$h][1] = $langs->trans("DefaultRights"); -$hselected=$h; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security.php"; -$head[$h][1] = $langs->trans("Passwords"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; -$head[$h][1] = $langs->trans("Miscellanous"); -$h++; - -dolibarr_fiche_head($head, $hselected, $langs->trans("Security")); +dolibarr_fiche_head($head, 'default', $langs->trans("Security")); print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules")); diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index b7d38ef5b1d..1fb86f8ebc5 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * * This program is free software; you can redistribute it and/or modify @@ -15,15 +15,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ */ /** \file htdocs/admin/security.php \ingroup setup \brief Page de configuration du module s�curit� - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -163,22 +161,9 @@ print $langs->trans("GeneratedPasswordDesc")."<br>\n"; print "<br>\n"; -$h = 0; - -$head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; -$head[$h][1] = $langs->trans("DefaultRights"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security.php"; -$head[$h][1] = $langs->trans("Passwords"); -$hselected=$h; -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; -$head[$h][1] = $langs->trans("Miscellanous"); -$h++; +$head=security_prepare_head(); -dolibarr_fiche_head($head, $hselected, $langs->trans("Security")); +dolibarr_fiche_head($head, 'passwords', $langs->trans("Security")); $var=false; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index f606505c471..6a8e66c6cd6 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -14,16 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Id$ - * $Source$ */ /** \file htdocs/admin/security_other.php - \ingroup setup + \ingroup core \brief Page de configuration du module s�curit� autre - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); @@ -91,22 +88,9 @@ print $langs->trans("MiscellanousDesc")."<br>\n"; print "<br>\n"; -$h = 0; - -$head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; -$head[$h][1] = $langs->trans("DefaultRights"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security.php"; -$head[$h][1] = $langs->trans("Passwords"); -$h++; - -$head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; -$head[$h][1] = $langs->trans("Miscellanous"); -$hselected=$h; -$h++; +$head=security_prepare_head(); -dolibarr_fiche_head($head, $hselected, $langs->trans("Security")); +dolibarr_fiche_head($head, 'misc', $langs->trans("Security")); $var=false; diff --git a/htdocs/agenda/events.class.php b/htdocs/core/events.class.php similarity index 92% rename from htdocs/agenda/events.class.php rename to htdocs/core/events.class.php index 8ce927a999f..d5a9fe7d5d7 100644 --- a/htdocs/agenda/events.class.php +++ b/htdocs/core/events.class.php @@ -17,8 +17,8 @@ */ /** - \file agenda/events.class.php - \ingroup agenda + \file core/events.class.php + \ingroup core \brief Events class file. \version $Id$ \author Laurent Destailleur @@ -47,7 +47,7 @@ class Events // extends CommonObject var $id; var $tms; - var $fk_action; + var $type; var $dateevent; var $label; var $description; @@ -91,9 +91,9 @@ class Events // extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; $sql.= "id,"; - $sql.= "tms,"; - $sql.= "fk_action,"; + $sql.= "type,"; $sql.= "dateevent,"; + $sql.= "fk_user,"; $sql.= "label,"; $sql.= "description"; @@ -101,9 +101,9 @@ class Events // extends CommonObject $sql.= ") VALUES ("; $sql.= " '".$this->id."',"; - $sql.= " ".$this->db->idate($this->tms).","; - $sql.= " '".$this->fk_action."',"; + $sql.= " '".$this->type."',"; $sql.= " ".$this->db->idate($this->dateevent).","; + $sql.= " '".$user->id."',"; $sql.= " '".$this->label."',"; $sql.= " '".$this->description."'"; @@ -139,7 +139,7 @@ class Events // extends CommonObject // Clean parameters $this->id=trim($this->id); - $this->fk_action=trim($this->fk_action); + $this->type=trim($this->type); $this->label=trim($this->label); $this->description=trim($this->description); @@ -152,8 +152,7 @@ class Events // extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."events SET"; $sql.= " id='".$this->id."',"; - $sql.= " tms=".$this->db->idate($this->tms).","; - $sql.= " fk_action='".$this->fk_action."',"; + $sql.= " type='".$this->type."',"; $sql.= " dateevent=".$this->db->idate($this->dateevent).","; $sql.= " label='".addslashes($this->label)."',"; $sql.= " description='".addslashes($this->description)."'"; @@ -188,7 +187,7 @@ class Events // extends CommonObject $sql.= " t.id,"; $sql.= " ".$this->db->pdate('t.tms').","; - $sql.= " t.fk_action,"; + $sql.= " t.type,"; $sql.= " ".$this->db->pdate('t.dateevent').","; $sql.= " t.label,"; $sql.= " t.description"; @@ -209,7 +208,7 @@ class Events // extends CommonObject $this->id = $obj->id; $this->tms = $obj->tms; - $this->fk_action = $obj->fk_action; + $this->type = $obj->type; $this->dateevent = $obj->dateevent; $this->label = $obj->label; $this->description = $obj->description; @@ -262,14 +261,11 @@ class Events // extends CommonObject { $this->id=0; - $this->id=''; - $this->tms=''; - $this->fk_action=''; - $this->dateevent=''; - $this->label=''; - $this->description=''; - - + $this->tms=time(); + $this->type=''; + $this->dateevent=time(); + $this->label='Speciment event'; + $this->description='This is a specimen event'; } } diff --git a/htdocs/fourn/facture/paiementfourn.class.php b/htdocs/fourn/facture/paiementfourn.class.php index 672f8e7ac32..a3bd5c2868f 100644 --- a/htdocs/fourn/facture/paiementfourn.class.php +++ b/htdocs/fourn/facture/paiementfourn.class.php @@ -112,12 +112,14 @@ class PaiementFourn } /** - * \brief Cr�ation du paiement en base - * \param user object utilisateur qui cr�e - * \return int id du paiement cr�e, < 0 si erreur + * \brief Creta payment in database + * \param user Object of creating user + * \return int id of created payment, < 0 if error */ function create($user) { + global $langs,$conf; + $error = 0; // Nettoyage parametres @@ -169,7 +171,7 @@ class PaiementFourn // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/includes/triggers/interface_modAgenda_Eventsynchro.class.php b/htdocs/includes/triggers/interface_all_Logevents.class.php similarity index 94% rename from htdocs/includes/triggers/interface_modAgenda_Eventsynchro.class.php rename to htdocs/includes/triggers/interface_all_Logevents.class.php index 31ad6b9c39b..89c17043352 100644 --- a/htdocs/includes/triggers/interface_modAgenda_Eventsynchro.class.php +++ b/htdocs/includes/triggers/interface_all_Logevents.class.php @@ -17,21 +17,19 @@ */ /** - \file htdocs/includes/triggers/interface_modAgenda_Eventsynchro.class.php - \ingroup agenda + \file htdocs/includes/triggers/interface_all_Logevents.class.php + \ingroup core \brief Trigger file for \version $Id$ */ -include_once(DOL_DOCUMENT_ROOT.'/agenda/events.class.php'); - /** - \class InterfaceEventsynchro + \class InterfaceLogevents \brief Classe des fonctions triggers des actions agenda */ -class InterfaceEventsynchro +class InterfaceLogevents { var $db; var $error; @@ -45,13 +43,13 @@ class InterfaceEventsynchro * \brief Constructeur. * \param DB Handler d'acces base */ - function InterfaceEventsynchro($DB) + function InterfaceLogevents($DB) { $this->db = $DB ; $this->name = "Eventsynchro"; - $this->family = "agenda"; - $this->description = "Les triggers de ce composant permettent d'inserer un evenement dans le calendrier event pour chaque grand evenement Dolibarr."; + $this->family = "core"; + $this->description = "Les triggers de ce composant permettent de logguer les evenements Dolibarr (modification status des objets)."; $this->version = 'dolibarr'; // 'experimental' or 'dolibarr' or version } @@ -94,18 +92,18 @@ class InterfaceEventsynchro * \param action Code de l'evenement * \param object Objet concerne * \param user Objet user - * \param lang Objet lang + * \param langs Objet langs * \param conf Objet conf * \return int <0 si ko, 0 si aucune action faite, >0 si ok */ function run_trigger($action,$object,$user,$langs,$conf) { - // Mettre ici le code a executer en reaction de l'action - // Les donnees de l'action sont stockees dans $object - - if (! $conf->agenda->enabled) return 0; // Module non actif - if (! $object->use_agenda) return 0; // Option syncro agenda non active + if (! empty($conf->global->MAIN_LOGEVENTS_DISABLE_ALL)) return 0; // Log events is disabled (hidden features) + $key='MAIN_LOGEVENTS_'.$action; + //dolibarr_syslog("xxxxxxxxxxx".$key); + if (empty($conf->global->$key)) return 0; // Log events not enabled for this action + // Actions if ($action == 'ACTION_CREATE') { @@ -373,10 +371,13 @@ class InterfaceEventsynchro // Ajoute entree dans webcal if ($this->date) { - $event->date=$this->date; - $event->duree=$this->duree; - $event->texte=$this->texte; - $event->desc=$this->desc; + include_once(DOL_DOCUMENT_ROOT.'/core/events.class.php'); + + $event=new Events($this->db); + $event->type=$action; + $event->dateevent=$this->date; + $event->label=$this->texte; + $event->description=$this->desc; $result=$event->create($user); if ($result > 0) diff --git a/htdocs/interfaces.class.php b/htdocs/interfaces.class.php index d72999d1f87..2cb91ceebe2 100644 --- a/htdocs/interfaces.class.php +++ b/htdocs/interfaces.class.php @@ -55,7 +55,7 @@ class Interfaces * \param conf Objet conf * \return int Nb triggers ayant agit si pas d'erreurs, -Nb en erreur sinon. */ - function run_triggers($action,$object,$user,$lang,$conf) + function run_triggers($action,$object,$user,$langs,$conf) { $handle=opendir($this->dir); $modules = array(); @@ -102,7 +102,7 @@ class Interfaces { $modules[$i] = $modName; //dolibarr_syslog("Interfaces::run_triggers Launch triggers for file '".$file."'",LOG_INFO); - $result=$objMod->run_trigger($action,$object,$user,$lang,$conf); + $result=$objMod->run_trigger($action,$object,$user,$langs,$conf); if ($result > 0) { // Action OK diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index d1c0b2bfcc9..17bf5c336b5 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -513,6 +513,10 @@ SetupDescription1=All the parameters available in the setup area allow you to se SetupDescription2=The 2 most important setup steps are the 2 first ones in the left setup menu, this means Company/fundation setup page and Modules setup page: SetupDescription3=<b>Company/fundation</b> setup is required because input information is used on Dolibarr displays and to modify Dolibarr behaviour (for example for features related to your country). SetupDescription4=<b>Modules</b> setup is required because Dolibarr is not a simple ERP/CRM but a sum of several modules, all more or less independant. It's only after activating modules you're interesting in that you will see features appeared in Dolibarr menu. +EventsSetup=Setup for events logs +LogEvents=Events +Audit=Audit +LogEventDesc=You can enable here log for some common events in the dolibarr event table. AreaForAdminOnly=Those features can be used by <b>administrator users</b> only. Administrator features and help are identified in Dolibarr by the following picto: SystemInfoDesc=System information is miscellanous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available for administrator users only. None of the Dolibarr permissions can reduce this limit. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 98eecd73d2c..dc7913184f8 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -512,6 +512,10 @@ SetupDescription1=Toutes les options de l'espace configuration sont des options SetupDescription2=Les 2 �tapes indispensables de configuration sont les 2 premi�res dans le menu gauche, � savoir, la configuration de la soci�t�/institution et la configuration des modules: SetupDescription3=La configuration <b>Soci�t�/institution</b> � g�rer est requise car les informations saisies sont utilis�es dans la plupart des �crans, en affichage, ou pour modifier le comportement de Dolibarr (comme par exemple des fonctions qui d�pendent de votre pays). SetupDescription4=La configuration <b>Modules</b> est indispensable car Dolibarr n'est pas un ERP/CRM monolithique mais un ensemble de modules tous plus ou moins ind�pendant. C'est apr�s avoir activ� les modules qui vous int�ressent que vous verrez apparaitre les fonctionnalit�s dans les menus de Dolibarr. +EventsSetup=Configuration du tra�age des �venements +LogEvents=Ev�nements +Audit=Audit +LogEventDesc=Vous pouvez activer ici, le tra�age de l'historique des ev�nements dans la table des ev�nements Dolibarr. AreaForAdminOnly=Ces fonctions ne sont accessibles qu'� un utilisateur administrateur. La fonction d'administrateur et les aides pour les administrateurs sont identifi�es dans Dolibarr par le picto suivant: SystemInfoDesc=Les informations syst�mes sont des informations techniques diverses accessibles en lecture seule aux administrateurs uniquement. SystemAreaForAdminOnly=Cet espace n'est accessible qu'aux utilisateurs de type administrateurs. Aucune permission Dolibarr ne permet d'�tendre le cercle des utilisateurs autoris�s � cet espace. diff --git a/htdocs/lib/admin.lib.php b/htdocs/lib/admin.lib.php index 4f13ed09257..8df57721f83 100644 --- a/htdocs/lib/admin.lib.php +++ b/htdocs/lib/admin.lib.php @@ -304,5 +304,42 @@ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $not return -1; } } + + +/** + \file htdocs/lib/company.lib.php + \brief Ensemble de fonctions de base pour le module societe + \ingroup societe + \version $Id$ +*/ + +function security_prepare_head() +{ + global $langs, $conf, $user; + $h = 0; + $head = array(); + + $head[$h][0] = DOL_URL_ROOT."/admin/perms.php"; + $head[$h][1] = $langs->trans("DefaultRights"); + $head[$h][2] = 'default'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/security.php"; + $head[$h][1] = $langs->trans("Passwords"); + $head[$h][2] = 'passwords'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/security_other.php"; + $head[$h][1] = $langs->trans("Miscellanous"); + $head[$h][2] = 'misc'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/admin/events.php"; + $head[$h][1] = $langs->trans("Audit"); + $head[$h][2] = 'audit'; + $h++; + + return $head; +} ?> \ No newline at end of file diff --git a/htdocs/paiement.class.php b/htdocs/paiement.class.php index aa5d2d68235..4f2f94dd693 100644 --- a/htdocs/paiement.class.php +++ b/htdocs/paiement.class.php @@ -120,6 +120,8 @@ class Paiement */ function create($user) { + global $langs,$conf; + $error = 0; // Nettoyage parametres @@ -177,7 +179,7 @@ class Paiement // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('PAYMENT_CUSTOMER_CREATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/user.class.php b/htdocs/user.class.php index 90dc8fdb147..fe68e98fc29 100644 --- a/htdocs/user.class.php +++ b/htdocs/user.class.php @@ -604,7 +604,7 @@ class User extends CommonObject // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_DISABLE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('USER_DISABLE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -659,7 +659,7 @@ class User extends CommonObject // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_DELETE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('USER_DELETE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers @@ -747,7 +747,7 @@ class User extends CommonObject // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface = new Interfaces($this->db); - $result = $interface->run_triggers('USER_CREATE',$this,$user,$lang,$conf); + $result = $interface->run_triggers('USER_CREATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } @@ -1048,7 +1048,7 @@ class User extends CommonObject // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_MODIFY',$this,$user,$lang,$conf); + $result=$interface->run_triggers('USER_MODIFY',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/htdocs/usergroup.class.php b/htdocs/usergroup.class.php index 9f04bf135d2..2370e7becea 100644 --- a/htdocs/usergroup.class.php +++ b/htdocs/usergroup.class.php @@ -366,7 +366,7 @@ class UserGroup // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('USER_DELETE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('USER_DELETE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers @@ -403,7 +403,7 @@ class UserGroup // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('GROUP_CREATE',$this,$user,$lang,$conf); + $result=$interface->run_triggers('GROUP_CREATE',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers @@ -443,7 +443,7 @@ class UserGroup // Appel des triggers include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php"); $interface=new Interfaces($this->db); - $result=$interface->run_triggers('GROUP_MODIFY',$this,$user,$lang,$conf); + $result=$interface->run_triggers('GROUP_MODIFY',$this,$user,$langs,$conf); if ($result < 0) { $error++; $this->errors=$interface->errors; } // Fin appel triggers } diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index b51b4586186..6a0e96810f3 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -175,17 +175,19 @@ ALTER TABLE llx_element_element ADD INDEX idx_element_element_targetid (targetid ALTER TABLE llx_actioncomm add column fk_user_mod integer after fk_user_author; ALTER TABLE llx_actioncomm add column fk_user_done integer after fk_user_action; - +drop table if exists llx_events; create table llx_events ( id integer AUTO_INCREMENT PRIMARY KEY, - tms timestamp, - fk_action integer, - dateevent datetime, - label varchar(50) NOT NULL, - description text NOT NULL + tms timestamp, -- date creation/modification + type varchar(32) NOT NULL, -- action type + dateevent datetime, -- date event + fk_user integer, -- id user + label varchar(50) NOT NULL, -- label of action + description text NOT NULL -- full description of action ) type=innodb; + ALTER TABLE llx_events ADD INDEX idx_events_dateevent (dateevent); ALTER TABLE llx_c_forme_juridique ADD isvatexempted tinyint DEFAULT 0 NOT NULL after libelle; diff --git a/mysql/tables/llx_events.sql b/mysql/tables/llx_events.sql index e6eaaf71dc8..d3440eada55 100644 --- a/mysql/tables/llx_events.sql +++ b/mysql/tables/llx_events.sql @@ -25,8 +25,9 @@ create table llx_events ( id integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, -- date creation/modification - fk_action integer, -- action type + type varchar(32) NOT NULL, -- action type dateevent datetime, -- date event + fk_user integer, -- id user label varchar(50) NOT NULL, -- label of action description text NOT NULL -- full description of action ) type=innodb; -- GitLab