From 37ce175d538a2382334b914dbf071976a41a7896 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 10:27:54 +0100 Subject: [PATCH 1/2] Fix user status --- htdocs/societe/list.php | 2 +- htdocs/user/class/user.class.php | 12 +++++++++--- htdocs/user/list.php | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index f0ef18e4dfd..96666b28d8c 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1311,7 +1311,7 @@ if (!empty($arrayfields['s.tms']['checked'])) { // Status if (!empty($arrayfields['s.status']['checked'])) { print ''; - print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75 maxwidth125 onrightofpage', 1); + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $search_status, 1, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage', 1); print ''; } if (!empty($arrayfields['s.import_key']['checked'])) { diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index dddcaa0ca6a..744e24fe15a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -436,7 +436,7 @@ class User extends CommonObject $sql .= " u.admin, u.login, u.note_private, u.note_public,"; $sql .= " u.pass, u.pass_crypted, u.pass_temp, u.api_key,"; $sql .= " u.fk_soc, u.fk_socpeople, u.fk_member, u.fk_user, u.ldap_sid, u.fk_user_expense_validator, u.fk_user_holiday_validator,"; - $sql .= " u.statut, u.lang, u.entity,"; + $sql .= " u.statut as status, u.lang, u.entity,"; $sql .= " u.datec as datec,"; $sql .= " u.tms as datem,"; $sql .= " u.datelastlogin as datel,"; @@ -553,7 +553,10 @@ class User extends CommonObject $this->note_public = $obj->note_public; $this->note_private = $obj->note_private; $this->note = $obj->note_private; // deprecated - $this->statut = $obj->statut; + + $this->statut = $obj->status; // deprecated + $this->status = $obj->status; + $this->photo = $obj->photo; $this->openid = $obj->openid; $this->lang = $obj->lang; @@ -1350,7 +1353,10 @@ class User extends CommonObject $error = 0; // Check parameters - if ($this->statut == $status) { + if (isset($this->statut) && $this->statut == $status) { + return 0; + } + if (isset($this->status) && $this->status == $status) { return 0; } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 8610113f0da..d3139b438e2 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -800,7 +800,7 @@ if (!empty($arrayfields['u.tms']['checked'])) { if (!empty($arrayfields['u.statut']['checked'])) { // Status print ''; - print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'minwidth75imp'); + print $form->selectarray('search_statut', array('-1'=>'', '0'=>$langs->trans('Disabled'), '1'=>$langs->trans('Enabled')), $search_statut, 0, 0, 0, '', 0, 0, 0, '', 'search_status minwidth75imp maxwidth125 onrightofpage'); print ''; } // Action column From 9f02bd2350ed9b256c7f2d978cb9514e521df3e7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 3 Jan 2023 11:32:33 +0100 Subject: [PATCH 2/2] Debug v17 --- htdocs/user/class/user.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 744e24fe15a..e90252877d1 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1353,10 +1353,11 @@ class User extends CommonObject $error = 0; // Check parameters - if (isset($this->statut) && $this->statut == $status) { - return 0; - } - if (isset($this->status) && $this->status == $status) { + if (isset($this->statut)) { + if ($this->statut == $status) { + return 0; + } + } elseif (isset($this->status) && $this->status == $status) { return 0; } @@ -3259,7 +3260,8 @@ class User extends CommonObject $this->iplastlogin = '127.0.0.1'; $this->datepreviouslogin = $now; $this->ippreviouslogin = '127.0.0.1'; - $this->statut = 1; + $this->statut = 1; // deprecated + $this->status = 1; $this->entity = 1; return 1;