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;
|
$editgroup->oldcopy = clone $editgroup;
|
||||||
|
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
|
|
||||||
if ($action == 'addgroup') {
|
if ($action == 'addgroup') {
|
||||||
$result = $object->SetInGroup($group, $editgroup->entity);
|
$result = $object->SetInGroup($group, $editgroup->entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2651,7 +2651,11 @@ class User extends CommonObject
|
|||||||
$sql = "DELETE FROM ".$this->db->prefix()."usergroup_user";
|
$sql = "DELETE FROM ".$this->db->prefix()."usergroup_user";
|
||||||
$sql .= " WHERE fk_user = ".((int) $this->id);
|
$sql .= " WHERE fk_user = ".((int) $this->id);
|
||||||
$sql .= " AND fk_usergroup = ".((int) $group);
|
$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);
|
$result = $this->db->query($sql);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user