Modification de la trace pour meilleur suivi dans logs

This commit is contained in:
Laurent Destailleur 2006-12-05 23:02:06 +00:00
parent cb5ae8ff6b
commit 98f73194c6
2 changed files with 110 additions and 109 deletions

View File

@ -37,108 +37,109 @@
class InterfaceUser class InterfaceUser
{ {
var $db; var $db;
var $error;
/**
* \brief Constructeur. /**
* \param DB Handler d'accès base * \brief Constructeur.
*/ * \param DB Handler d'accès base
function InterfaceUser($DB) */
{ function InterfaceUser($DB)
$this->db = $DB ; {
$this->db = $DB ;
$this->name = "User";
$this->family = "user"; $this->name = "User";
$this->description = "Les triggers de ce composant s'appliquent sur les utilisateurs."; $this->family = "user";
$this->revision = explode(' ','$Revision$'); $this->description = "Les triggers de ce composant s'appliquent sur les utilisateurs.";
$this->version = $this->revision[1]; $this->revision = explode(' ','$Revision$');
} $this->version = $this->revision[1];
}
/**
* \brief Renvoi nom du lot de triggers /**
* \return string Nom du lot de triggers * \brief Renvoi nom du lot de triggers
*/ * \return string Nom du lot de triggers
function getName() */
{ function getName()
return $this->name; {
} return $this->name;
}
/**
* \brief Renvoi descriptif du lot de triggers /**
* \return string Descriptif du lot de triggers * \brief Renvoi descriptif du lot de triggers
*/ * \return string Descriptif du lot de triggers
function getDesc() */
{ function getDesc()
return $this->description; {
} return $this->description;
}
/**
* \brief Renvoi version du lot de triggers /**
* \return string Version du lot de triggers * \brief Renvoi version du lot de triggers
*/ * \return string Version du lot de triggers
function getVersion() */
{ function getVersion()
global $langs; {
$langs->load("admin"); global $langs;
$langs->load("admin");
if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version == 'dolibarr') return DOL_VERSION; if ($this->version == 'experimental') return $langs->trans("Experimental");
elseif ($this->version) return $this->version; elseif ($this->version == 'dolibarr') return DOL_VERSION;
else return $langs->trans("Unknown"); elseif ($this->version) return $this->version;
} else return $langs->trans("Unknown");
}
/**
* \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr. /**
* D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers * \brief Fonction appelée lors du déclenchement d'un évènement Dolibarr.
* \param action Code de l'evenement * D'autres fonctions run_trigger peuvent etre présentes dans includes/triggers
* \param object Objet concerné * \param action Code de l'evenement
* \param user Objet user * \param object Objet concern
* \param lang Objet lang * \param user Objet user
* \param conf Objet conf * \param lang Objet lang
* \return int <0 si ko, 0 si aucune action faite, >0 si ok * \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) */
{ function run_trigger($action,$object,$user,$langs,$conf)
// Mettre ici le code à exécuter en réaction de l'action {
// Les données de l'action sont stockées dans $object // Mettre ici le code à exécuter en réaction de l'action
// Les données de l'action sont stockées dans $object
// Users
if ($action == 'USER_CREATE') // Users
{ if ($action == 'USER_CREATE')
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); {
dolibarr_syslog($conf->global->STOCK_USERSTOCK . ' '. $conf->global->STOCK_USERSTOCK_AUTOCREATE ); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->global->STOCK_USERSTOCK == 1 && $conf->global->STOCK_USERSTOCK_AUTOCREATE == 1) dolibarr_syslog($conf->global->STOCK_USERSTOCK . ' '. $conf->global->STOCK_USERSTOCK_AUTOCREATE );
{ if ($conf->global->STOCK_USERSTOCK == 1 && $conf->global->STOCK_USERSTOCK_AUTOCREATE == 1)
require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php"); {
$entrepot = new Entrepot($this->db); require_once(DOL_DOCUMENT_ROOT."/product/stock/entrepot.class.php");
$entrepot->libelle = 'Stock Personnel '.$object->nom; $entrepot = new Entrepot($this->db);
$entrepot->description = 'Cet entrepot représente le stock personnel de '.$object->prenom.' '.$object->nom; $entrepot->libelle = 'Stock Personnel '.$object->nom;
$entrepot->statut = 1; $entrepot->description = 'Cet entrepot représente le stock personnel de '.$object->prenom.' '.$object->nom;
$entrepot->create($user); $entrepot->statut = 1;
} $entrepot->create($user);
}
}
elseif ($action == 'USER_MODIFY') }
{ elseif ($action == 'USER_MODIFY')
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); {
} dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
elseif ($action == 'USER_NEW_PASSWORD') }
{ elseif ($action == 'USER_NEW_PASSWORD')
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); {
} dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
elseif ($action == 'USER_DISABLE') }
{ elseif ($action == 'USER_DISABLE')
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); {
} dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
else
{ else
dolibarr_syslog("Trigger '".$this->name."' for action '$action' was ran but no handler found for this action."); {
return -1; dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
} return -1;
return 0; }
} return 0;
}
} }
?> ?>

View File

@ -204,7 +204,7 @@ class InterfaceWebCal
} }
elseif ($action == 'PROPAL_CLOSE_SIGNED') elseif ($action == 'PROPAL_CLOSE_SIGNED')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -215,7 +215,7 @@ class InterfaceWebCal
} }
elseif ($action == 'PROPAL_CLOSE_REFUSED') elseif ($action == 'PROPAL_CLOSE_REFUSED')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -227,7 +227,7 @@ class InterfaceWebCal
elseif ($action == 'BILL_VALIDATE') elseif ($action == 'BILL_VALIDATE')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -238,7 +238,7 @@ class InterfaceWebCal
} }
elseif ($action == 'BILL_PAYED') elseif ($action == 'BILL_PAYED')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -249,7 +249,7 @@ class InterfaceWebCal
} }
elseif ($action == 'BILL_CANCELED') elseif ($action == 'BILL_CANCELED')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched. id=".$object->id); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -261,7 +261,7 @@ class InterfaceWebCal
// Payments // Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE') elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();
@ -273,7 +273,7 @@ class InterfaceWebCal
} }
elseif ($action == 'PAYMENT_SUPPLIER_CREATE') elseif ($action == 'PAYMENT_SUPPLIER_CREATE')
{ {
dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched"); dolibarr_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
$langs->load("other"); $langs->load("other");
$this->date=time(); $this->date=time();