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