mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Fix delete group of a user
This commit is contained in:
parent
b4702aee24
commit
09a0d579ce
|
|
@ -375,6 +375,7 @@ if (empty($reshook)) {
|
|||
$editgroup->oldcopy = clone $editgroup;
|
||||
|
||||
$object->fetch($id);
|
||||
|
||||
if ($action == 'addgroup') {
|
||||
$result = $object->SetInGroup($group, $editgroup->entity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2651,7 +2651,11 @@ class User extends CommonObject
|
|||
$sql = "DELETE FROM ".$this->db->prefix()."usergroup_user";
|
||||
$sql .= " WHERE fk_user = ".((int) $this->id);
|
||||
$sql .= " AND fk_usergroup = ".((int) $group);
|
||||
$sql .= " AND entity = ".((int) $entity);
|
||||
if (empty($entity)) {
|
||||
$sql .= " AND entity IN (0, 1)"; // group may be in entity 0 (so $entity=0) and link with user into entity 1.
|
||||
} else {
|
||||
$sql .= " AND entity = ".((int) $entity);
|
||||
}
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user