Finally, better without the test

This commit is contained in:
Laurent Destailleur 2016-07-29 11:19:16 +02:00
parent 4cadf0e5a3
commit 537a51b367

View File

@ -1939,21 +1939,8 @@ class Societe extends CommonObject
$contact_emails = $this->contact_property_array('email',1); $contact_emails = $this->contact_property_array('email',1);
if ($this->email && $addthirdparty) if ($this->email && $addthirdparty)
{ {
$exist = 0; if (empty($this->name)) $this->name=$this->nom;
foreach($contact_emails as $contacts){ $contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
if($exist ===0){
$contacts = str_replace('>','',$contacts);
$contacts = explode ('<',$contacts);
if($contacts[1]===$this->email){
$exist = 1;
}
}
}
if($exist ===0){
if (empty($this->name)) $this->name=$this->nom;
$contact_emails['thirdparty']=$langs->trans("ThirdParty").': '.dol_trunc($this->name,16)." <".$this->email.">";
}
} }
return $contact_emails; return $contact_emails;
} }