Qual: Removed useless function
This commit is contained in:
parent
b4bffb902f
commit
fa82cbceb9
@ -3383,9 +3383,8 @@ abstract class CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Call trigger based on this instance
|
* Call trigger based on this instance
|
||||||
*
|
* NB: Error from trigger are stacked in interface->errors
|
||||||
* NB: Error from trigger are stacked in errors
|
* NB2: If return code of triggers are < 0, action calling trigger should cancel all transaction.
|
||||||
* NB2: if trigger fail, action should be canceled.
|
|
||||||
*
|
*
|
||||||
* @param string $trigger_name trigger's name to execute
|
* @param string $trigger_name trigger's name to execute
|
||||||
* @param User $user Object user
|
* @param User $user Object user
|
||||||
@ -3393,23 +3392,23 @@ abstract class CommonObject
|
|||||||
*/
|
*/
|
||||||
function call_trigger($trigger_name, $user)
|
function call_trigger($trigger_name, $user)
|
||||||
{
|
{
|
||||||
global $langs,$conf;
|
global $langs,$conf;
|
||||||
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
if (!empty($this->errors))
|
|
||||||
{
|
|
||||||
$this->errors=array_merge($this->errors,$interface->errors);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers($trigger_name,$this,$user,$langs,$conf);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
if (!empty($this->errors))
|
||||||
|
{
|
||||||
|
$this->errors=array_merge($this->errors,$interface->errors);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->errors=$interface->errors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -667,7 +667,7 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_ENABLEDISABLE',$user);
|
$result=$this->call_trigger('USER_ENABLEDISABLE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -756,14 +756,14 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_DELETE',$user);
|
$result=$this->call_trigger('USER_DELETE',$user);
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -866,7 +866,7 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_CREATE',$user);
|
$result=$this->call_trigger('USER_CREATE',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,9 +949,9 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_CREATE_FROM_CONTACT',$user);
|
$result=$this->call_trigger('USER_CREATE_FROM_CONTACT',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
@ -1261,7 +1261,7 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_MODIFY',$user);
|
$result=$this->call_trigger('USER_MODIFY',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1352,7 +1352,7 @@ class User extends CommonObject
|
|||||||
if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
|
if (! is_object($this->oldcopy)) $this->oldcopy=dol_clone($this);
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."user";
|
||||||
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
$sql.= " SET pass_crypted = '".$this->db->escape($password_crypted)."',";
|
||||||
$sql.= " pass_temp = null";
|
$sql.= " pass_temp = null";
|
||||||
@ -1408,10 +1408,10 @@ class User extends CommonObject
|
|||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_NEW_PASSWORD',$user);
|
$result=$this->call_trigger('USER_NEW_PASSWORD',$user);
|
||||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
return $this->pass;
|
return $this->pass;
|
||||||
}
|
}
|
||||||
@ -1666,7 +1666,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_SETINGROUP',$user);
|
$result=$this->call_trigger('USER_SETINGROUP',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1720,7 +1720,7 @@ class User extends CommonObject
|
|||||||
|
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('USER_REMOVEFROMGROUP',$user);
|
$result=$this->call_trigger('USER_REMOVEFROMGROUP',$user);
|
||||||
if ($result < 0) { $error++; }
|
if ($result < 0) { $error++; }
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2281,7 +2281,7 @@ class User extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG);
|
dol_syslog(get_class($this)."::get_full_tree dol_sort_array", LOG_DEBUG);
|
||||||
$this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false);
|
$this->users=dol_sort_array($this->users, 'fullname', 'asc', true, false);
|
||||||
|
|
||||||
//$this->debug_users();
|
//var_dump($this->users);
|
||||||
|
|
||||||
return $this->users;
|
return $this->users;
|
||||||
}
|
}
|
||||||
@ -2322,24 +2322,5 @@ class User extends CommonObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Affiche contenu de $this->users
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function debug_users()
|
|
||||||
{
|
|
||||||
// Affiche $this->users
|
|
||||||
foreach($this->users as $key => $val)
|
|
||||||
{
|
|
||||||
print 'id: '.$this->users[$key]['id'];
|
|
||||||
print ' name: '.$this->users[$key]['name'];
|
|
||||||
print ' parent: '.$this->users[$key]['fk_user'];
|
|
||||||
print ' fullpath: '.$this->users[$key]['fullpath'];
|
|
||||||
print ' fullname: '.$this->users[$key]['fullname'];
|
|
||||||
print "<br>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user