From 2938e01fdd1d2c6e48e11f38ef19b05716f4dd0c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 7 Dec 2016 19:16:33 +0100 Subject: [PATCH] Fix a delete must be done after a fetch --- htdocs/user/card.php | 2 +- htdocs/user/class/user.class.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8fa91cb57a2..8b5ab723bd3 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -148,7 +148,7 @@ if (empty($reshook)) { if ($action == 'confirm_delete' && $confirm == "yes" && $candisableuser) { if ($id <> $user->id) { $object = new User($db); - $object->id = $id; + $object->fetch($id); $result = $object->delete(); if ($result < 0) { $langs->load("errors"); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 7fae93b6a6e..d917b53078a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -159,9 +159,9 @@ class User extends CommonObject /** * Load a user from database with its id or ref (login) * - * @param int $id Si defini, id a utiliser pour recherche - * @param string $login Si defini, login a utiliser pour recherche - * @param string $sid Si defini, sid a utiliser pour recherche + * @param int $id If defined, id to used for search + * @param string $login If defined, login to used for search + * @param string $sid If defined, sid to used for search * @param int $loadpersonalconf 1=also load personal conf of user (in $user->conf->xxx) * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. * @return int <0 if KO, 0 not found, >0 if OK