diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php new file mode 100644 index 00000000000..9760e68e753 --- /dev/null +++ b/htdocs/admin/tools/listevents.php @@ -0,0 +1,137 @@ + + * + * 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/compta/clients.php + \ingroup compta + \brief Page accueil des clients + \version $Id$ +*/ + +require_once("./pre.inc.php"); + +if (! $user->admin) + accessforbidden(); + +$langs->load("companies"); + +$page=$_GET["page"]; +$sortorder=$_GET["sortorder"]; +$sortfield=$_GET["sortfield"]; + +if (! $sortorder) $sortorder="DESC"; +if (! $sortfield) $sortfield="dateevent"; +if ($page == -1) { $page = 0 ; } +$offset = $conf->liste_limit * $page ; +$pageprev = $page - 1; +$pagenext = $page + 1; + + +llxHeader(); + +// Sécurité accés client +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + + +/* + * Mode Liste + * + */ + +$sql = "SELECT e.rowid, e.type, ".$db->pdate("e.dateevent")." as dateevent,"; +$sql.= " e.fk_user, e.label, e.description"; +$sql.= " FROM ".MAIN_DB_PREFIX."events as e"; + +$sql .= " ORDER BY $sortfield $sortorder"; +$sql .= $db->plimit($conf->liste_limit+1, $offset); + +$result = $db->query($sql); +if ($result) +{ + $num = $db->num_rows($result); + $i = 0; + + print_barre_liste($langs->trans("ListOfEvents"), $page, "listevents.php","",$sortfield,$sortorder,'',$num); + + print ''; + print ''; + print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"e.type","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("User"),$_SERVER["PHP_SELF"],"e.fk_user","","",'align="left"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"e.label","","",'align="left"',$sortfield,$sortorder); + print ''; + print "\n"; + +/* + // Lignes des champs de filtre + print ''; + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print ''; + + print "\n"; + print ''; +*/ + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object(); + + $var=!$var; + + print ""; + print ''; + print ''; + print ''; + print ''; +// print ''; + print ''; + print "\n"; + $i++; + } + print "
 
  '; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'.dolibarr_print_date($obj->dateevent,'dayhour').''.$obj->type.''.$obj->fk_user.''.$obj->label.''.$obj->description.' 
"; + $db->free(); +} +else +{ + dolibarr_print_error($db); +} + +$db->close(); + +llxFooter('$Date$ révision $Revision$'); +?> diff --git a/htdocs/admin/tools/pre.inc.php b/htdocs/admin/tools/pre.inc.php index 48676e9c7b5..20f82ceb450 100644 --- a/htdocs/admin/tools/pre.inc.php +++ b/htdocs/admin/tools/pre.inc.php @@ -14,15 +14,12 @@ * 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/tools/pre.inc.php \brief Fichier gestionnaire menu page outils - \version $Revision$ + \version $Id$ */ require("../../main.inc.php"); @@ -41,7 +38,9 @@ function llxHeader($head = "", $urlp = "") $menu->add(DOL_URL_ROOT."/admin/tools/index.php", "SystemTools"); $menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup")); $menu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore")); + $menu->add_submenu(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade")); $menu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge")); + $menu->add_submenu(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit")); left_menu($menu->liste); } diff --git a/htdocs/comm/prospect/prospects.php b/htdocs/comm/prospect/prospects.php index e3092e0fea0..3ae9dab08e1 100644 --- a/htdocs/comm/prospect/prospects.php +++ b/htdocs/comm/prospect/prospects.php @@ -15,16 +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$ - * $Source$ */ /** \file htdocs/comm/prospect/prospects.php \ingroup prospect \brief Page de la liste des prospects - \version $Revision$ + \version $Id$ */ require("./pre.inc.php"); diff --git a/htdocs/core/events.class.php b/htdocs/core/events.class.php index d5a9fe7d5d7..0ba0d01e990 100644 --- a/htdocs/core/events.class.php +++ b/htdocs/core/events.class.php @@ -90,7 +90,6 @@ class Events // extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."events("; - $sql.= "id,"; $sql.= "type,"; $sql.= "dateevent,"; $sql.= "fk_user,"; @@ -100,7 +99,6 @@ class Events // extends CommonObject $sql.= ") VALUES ("; - $sql.= " '".$this->id."',"; $sql.= " '".$this->type."',"; $sql.= " ".$this->db->idate($this->dateevent).","; $sql.= " '".$user->id."',"; @@ -151,12 +149,10 @@ class Events // extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."events SET"; - $sql.= " id='".$this->id."',"; $sql.= " type='".$this->type."',"; $sql.= " dateevent=".$this->db->idate($this->dateevent).","; $sql.= " label='".addslashes($this->label)."',"; $sql.= " description='".addslashes($this->description)."'"; - $sql.= " WHERE rowid=".$this->id; @@ -185,7 +181,6 @@ class Events // extends CommonObject $sql = "SELECT"; $sql.= " t.rowid,"; - $sql.= " t.id,"; $sql.= " ".$this->db->pdate('t.tms').","; $sql.= " t.type,"; $sql.= " ".$this->db->pdate('t.dateevent').","; @@ -206,7 +201,6 @@ class Events // extends CommonObject $this->id = $obj->rowid; - $this->id = $obj->id; $this->tms = $obj->tms; $this->type = $obj->type; $this->dateevent = $obj->dateevent; diff --git a/htdocs/includes/menus/barre_left/eldy_backoffice.php b/htdocs/includes/menus/barre_left/eldy_backoffice.php index 306dc864d39..0473848dfbe 100644 --- a/htdocs/includes/menus/barre_left/eldy_backoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_backoffice.php @@ -152,8 +152,9 @@ class MenuLeft { $newmenu->add(DOL_URL_ROOT."/admin/tools/index.php?leftmenu=admintools", $langs->trans("SystemTools")); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup"),1); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore"),1); - if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1); + if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1); + if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1); if ($leftmenu=="admintools" && function_exists('eaccelerator_info')) $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1); } diff --git a/htdocs/includes/menus/barre_left/eldy_frontoffice.php b/htdocs/includes/menus/barre_left/eldy_frontoffice.php index 61ad5c81bf4..c3dc0e275ea 100644 --- a/htdocs/includes/menus/barre_left/eldy_frontoffice.php +++ b/htdocs/includes/menus/barre_left/eldy_frontoffice.php @@ -154,8 +154,9 @@ class MenuLeft { $newmenu->add(DOL_URL_ROOT."/admin/tools/index.php?leftmenu=admintools", $langs->trans("SystemTools")); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_export.php", $langs->trans("Backup"),1); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/dolibarr_import.php", $langs->trans("Restore"),1); - if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1); if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/update.php", $langs->trans("Upgrade"),1); + if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/purge.php", $langs->trans("Purge"),1); + if ($leftmenu=="admintools") $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/listevents.php", $langs->trans("Audit"),1); if ($leftmenu=="admintools" && function_exists('eaccelerator_info')) $newmenu->add_submenu(DOL_URL_ROOT."/admin/tools/eaccelerator.php", $langs->trans("EAccelerator"),1); } diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 17bf5c336b5..cecc516a889 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -516,6 +516,8 @@ SetupDescription4=Modules setup is required because Dolibarr is not a sim EventsSetup=Setup for events logs LogEvents=Events Audit=Audit +ListEvents=Audit events +ListOfEvents=List of events LogEventDesc=You can enable here log for some common events in the dolibarr event table. AreaForAdminOnly=Those features can be used by administrator users 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. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index dc7913184f8..ae93aeea6bb 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -515,6 +515,8 @@ SetupDescription4=La configuration Modules est indispensable car Dolibarr EventsSetup=Configuration du traçage des évenements LogEvents=Evènements Audit=Audit +ListEvents=Audit évènements +ListOfEvents=Liste des évènements 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. diff --git a/mysql/migration/2.2.0-2.4.0.sql b/mysql/migration/2.2.0-2.4.0.sql index 6a0e96810f3..227fac81abf 100644 --- a/mysql/migration/2.2.0-2.4.0.sql +++ b/mysql/migration/2.2.0-2.4.0.sql @@ -178,7 +178,7 @@ 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, + rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, -- date creation/modification type varchar(32) NOT NULL, -- action type dateevent datetime, -- date event diff --git a/mysql/tables/llx_events.sql b/mysql/tables/llx_events.sql index d3440eada55..904dc9eda64 100644 --- a/mysql/tables/llx_events.sql +++ b/mysql/tables/llx_events.sql @@ -23,7 +23,7 @@ create table llx_events ( - id integer AUTO_INCREMENT PRIMARY KEY, + rowid integer AUTO_INCREMENT PRIMARY KEY, tms timestamp, -- date creation/modification type varchar(32) NOT NULL, -- action type dateevent datetime, -- date event