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
This commit is contained in:
Raphaël Doursenaud 2012-09-10 10:00:22 +02:00
parent 1d341caffd
commit 75647aa19d

View File

@ -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);