From 75647aa19d2c606c9b92614d75e090af8cfb260f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Doursenaud?= Date: Mon, 10 Sep 2012 10:00:22 +0200 Subject: [PATCH] Inverted the clause for commercial_id affectation This permits using a script to import commercial_id. The clause to automatically affect the current user as commercial doesn't seem to work anyway --- htdocs/societe/class/societe.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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);