diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 6ad2bde8468..5e3d592c23e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -227,16 +227,16 @@ class Societe extends CommonObject $ret = $this->update($this->id,$user,0,1,1,'add'); - // si un commercial cree un client il lui est affecte automatiquement - if (!$user->rights->societe->client->voir) - { - $this->add_commercial($user, $user->id); - } // Ajout du commercial affecte - else if ($this->commercial_id != '' && $this->commercial_id != -1) + if ($this->commercial_id != '' && $this->commercial_id != -1) { $this->add_commercial($user, $this->commercial_id); } + // si un commercial cree un client il lui est affecte automatiquement + else if (!$user->rights->societe->client->voir) + { + $this->add_commercial($user, $user->id); + } // si le fournisseur est classe on l'ajoute $this->AddFournisseurInCategory($this->fournisseur_categorie);