Add trigger USER_CREATE_FROM_CONTACT

This commit is contained in:
Regis Houssin
2010-11-08 17:34:38 +00:00
parent 005a824582
commit d20a3c64ba
2 changed files with 13 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* 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
@@ -118,6 +119,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_CREATE_FROM_CONTACT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'USER_MODIFY')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);

View File

@@ -803,7 +803,7 @@ class User extends CommonObject
*/
function create_from_contact($contact,$login='')
{
global $user,$langs;
global $conf,$user,$langs;
// Positionne parametres
$this->admin = 0;
@@ -829,6 +829,13 @@ class User extends CommonObject
dol_syslog("User::create_from_contact sql=".$sql, LOG_DEBUG);
if ($resql)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface = new Interfaces($this->db);
$result = $interface->run_triggers('USER_CREATE_FROM_CONTACT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
$this->db->commit();
return $this->id;
}