Fix: Duplicate automatic contact add when adding a third party.

This commit is contained in:
Laurent Destailleur 2008-04-21 12:47:23 +00:00
parent 9fd78b04a7
commit e3922a23f1
3 changed files with 7 additions and 33 deletions

View File

@ -159,8 +159,8 @@ class Contact extends CommonObject
}
$sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET ";
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
if ($this->socid == -1) $sql .= " fk_soc=null,";
if ($this->socid > 0) $sql .= " fk_soc='".addslashes($this->socid)."',";
if ($this->socid == -1) $sql .= " fk_soc=null,";
$sql .= " civilite='".addslashes($this->civilite_id)."'";
$sql .= ", name='".addslashes($this->name)."'";
$sql .= ", firstname='".addslashes($this->firstname)."'";

View File

@ -158,9 +158,9 @@ if ((! $_POST["getcustomercode"] && ! $_POST["getsuppliercode"])
$contact=new Contact($db);
$contact->civilite_id = $soc->civilite_id;
$contact->name=$soc->name;
$contact->firstname=$soc->firstname;
$contact->address=$soc->address;
$contact->name=$soc->nom_particulier;
$contact->firstname=$soc->prenom;
$contact->address=$soc->adresse;
$contact->cp=$soc->cp;
$contact->ville=$soc->ville;
$contact->fk_pays=$soc->fk_pays;

View File

@ -421,34 +421,8 @@ class Societe extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
//Si c'est un particulier on cr<63>e la fiche contact
if ($this->particulier == 1)
{
require_once (DOL_DOCUMENT_ROOT."/contact.class.php");
$contact = new Contact($this->db);
$contact->socid = $id;
$contact->name = $this->nom_particulier;
$contact->firstname = $this->prenom;
//$contact->civilite_id = $_POST["civilite_id"];
//$contact->poste = $_POST["poste"];
$contact->address = $this->adresse;
$contact->cp = $this->cp;
$contact->ville = $this->ville;
$contact->fk_pays = $this->pays_id;
$contact->email = $this->email;
$contact->phone_pro = $this->tel;
//$contact->phone_perso = $_POST["phone_perso"];
//$contact->phone_mobile = $_POST["phone_mobile"];
$contact->fax = $this->fax;
$id = $contact->create($user);
}
// si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);
// Si le fournisseur est classe on l'ajoute
$this->AddFournisseurInCategory($this->fournisseur_categorie);
if ($call_trigger)
{