New: Add "Audit" feature.

This commit is contained in:
Laurent Destailleur 2008-02-28 22:01:45 +00:00
parent 75207ea05c
commit a265ccb79f
10 changed files with 151 additions and 18 deletions

View File

@ -0,0 +1,137 @@
<?php
/* Copyright (C) 2004-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/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 '<table class="liste" width="100%">';
print '<tr class="liste_titre">';
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 '<td>&nbsp;</td>';
print "</tr>\n";
/*
// Lignes des champs de filtre
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
print '<tr class="liste_titre">';
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">&nbsp;</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_compta" value="'.$_GET["search_user"].'">';
print '</td>';
print '<td align="left" class="liste_titre">';
print '<input class="flat" type="text" size="10" name="search_compta" value="'.$_GET["search_label"].'">';
print '</td>';
print '<td align="right" class="liste_titre">';
print '<input type="image" class="liste_titre" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" name="button_search" alt="'.$langs->trans("Search").'">';
print '</td>';
print "</tr>\n";
print '</form>';
*/
$var=True;
while ($i < min($num,$conf->liste_limit))
{
$obj = $db->fetch_object();
$var=!$var;
print "<tr $bc[$var]>";
print '<td align="left" nowrap="nowrap">'.dolibarr_print_date($obj->dateevent,'dayhour').'</td>';
print '<td>'.$obj->type.'</td>';
print '<td>'.$obj->fk_user.'</td>';
print '<td>'.$obj->label.'</td>';
// print '<td>'.$obj->description.'</td>';
print '<td>&nbsp;</td>';
print "</tr>\n";
$i++;
}
print "</table>";
$db->free();
}
else
{
dolibarr_print_error($db);
}
$db->close();
llxFooter('$Date$ r&eacute;vision $Revision$');
?>

View File

@ -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);
}

View File

@ -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");

View File

@ -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;

View File

@ -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);
}

View File

@ -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);
}

View File

@ -516,6 +516,8 @@ SetupDescription4=<b>Modules</b> 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 <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.

View File

@ -515,6 +515,8 @@ SetupDescription4=La configuration <b>Modules</b> 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.

View File

@ -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

View File

@ -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