FIX #5544 Disabled Contact still appear in lists to send emails
This commit is contained in:
parent
0e79cae9d4
commit
b47e6e4520
@ -1936,12 +1936,24 @@ class Societe extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs;
|
global $langs;
|
||||||
|
|
||||||
$contact_emails = $this->contact_property_array('email');
|
$contact_emails = $this->contact_property_array('email',1);
|
||||||
if ($this->email && $addthirdparty)
|
if ($this->email && $addthirdparty)
|
||||||
{
|
{
|
||||||
if (empty($this->name)) $this->name=$this->nom;
|
$exist = 0;
|
||||||
// TODO: Tester si email non deja present dans tableau contact
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user