From 3477cf6bd3fc7c92425020a5e95beb53f906acce Mon Sep 17 00:00:00 2001 From: gauthier Date: Tue, 29 Jan 2019 18:01:28 +0100 Subject: [PATCH 1/5] FIX : must fetch member in current entity --- htdocs/user/class/user.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index ef2b828f6e5..42770041a5b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1483,9 +1483,9 @@ class User extends CommonObject // This user is linked with a member, so we also update member information // if this is an update. $adh=new Adherent($this->db); - $result=$adh->fetch($this->fk_member); + $result=$adh->fetch('',$this->fk_member); - if ($result >= 0) + if ($result > 0) { $adh->firstname=$this->firstname; $adh->lastname=$this->lastname; @@ -1520,7 +1520,7 @@ class User extends CommonObject $error++; } } - else + elseif(!empty($adh->error) || !empty($adh->errors)) { $this->error=$adh->error; $this->errors=$adh->errors; From 0c4e5a6487ec97d894df50bff72154462d0e486f Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 31 Jan 2019 09:30:07 +0100 Subject: [PATCH 2/5] FIX : better test --- htdocs/user/class/user.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 42770041a5b..5a154be7478 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1483,9 +1483,9 @@ class User extends CommonObject // This user is linked with a member, so we also update member information // if this is an update. $adh=new Adherent($this->db); - $result=$adh->fetch('',$this->fk_member); + $result=$adh->fetch($this->fk_member); - if ($result > 0) + if ($result > 0 && $adh->entity == $conf->entity) { $adh->firstname=$this->firstname; $adh->lastname=$this->lastname; From bfc7265cbc7ce819277ae5f6d3e2ff842c83974c Mon Sep 17 00:00:00 2001 From: gauthier Date: Thu, 31 Jan 2019 11:53:10 +0100 Subject: [PATCH 3/5] FIX : better test on fetch --- htdocs/adherents/class/adherent.class.php | 4 ++-- htdocs/user/class/user.class.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index c7807bc6b00..0b3a4dd45d4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -578,7 +578,7 @@ class Adherent extends CommonObject $lthirdparty=new Societe($this->db); $result=$lthirdparty->fetch($this->fk_soc); - if ($result >= 0) + if ($result > 0) { $lthirdparty->address=$this->address; $lthirdparty->zip=$this->zip; @@ -600,7 +600,7 @@ class Adherent extends CommonObject $error++; } } - else + elseif(!empty($lthirdparty->error)) { $this->error=$lthirdparty->error; $error++; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 5a154be7478..e305439e34a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1485,7 +1485,7 @@ class User extends CommonObject $adh=new Adherent($this->db); $result=$adh->fetch($this->fk_member); - if ($result > 0 && $adh->entity == $conf->entity) + if ($result > 0) { $adh->firstname=$this->firstname; $adh->lastname=$this->lastname; From 62d677118dc70d6cc7517bbd458b1094e5807167 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Feb 2019 19:24:18 +0100 Subject: [PATCH 4/5] Update adherent.class.php --- htdocs/adherents/class/adherent.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 0b3a4dd45d4..ac3e6890cf4 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -600,7 +600,7 @@ class Adherent extends CommonObject $error++; } } - elseif(!empty($lthirdparty->error)) + elseif ($result < 0) { $this->error=$lthirdparty->error; $error++; @@ -689,7 +689,6 @@ class Adherent extends CommonObject $this->db->rollback(); return -1; } - } /** From bd2c7092a47737f0a38859ed9bf9cd27e6b68e42 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 3 Feb 2019 19:25:11 +0100 Subject: [PATCH 5/5] Update user.class.php --- htdocs/user/class/user.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index e305439e34a..1b414795c24 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1520,7 +1520,7 @@ class User extends CommonObject $error++; } } - elseif(!empty($adh->error) || !empty($adh->errors)) + elseif ($result < 0) { $this->error=$adh->error; $this->errors=$adh->errors;