Update api_contacts.class.php

This commit is contained in:
ptibogxiv 2022-08-20 13:24:38 +02:00 committed by GitHub
parent 73321f0812
commit a4fa76eef4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -296,7 +296,7 @@ class Contacts extends DolibarrApi
if ($this->contact->create(DolibarrApiAccess::$user) < 0) { if ($this->contact->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating contact", array_merge(array($this->contact->error), $this->contact->errors)); throw new RestException(500, "Error creating contact", array_merge(array($this->contact->error), $this->contact->errors));
} }
if (isModEnabled('mailing') && !empty($this->contact->email)) { if (isModEnabled('mailing') && !empty($this->contact->email) && isset($this->contact->no_email)) {
$this->contact->setNoEmail($this->contact->no_email); $this->contact->setNoEmail($this->contact->no_email);
} }
return $this->contact->id; return $this->contact->id;
@ -331,7 +331,7 @@ class Contacts extends DolibarrApi
$this->contact->$field = $value; $this->contact->$field = $value;
} }
if (isModEnabled('mailing') && !empty($this->contact->email)) { if (isModEnabled('mailing') && !empty($this->contact->email) && isset($this->contact->no_email)) {
$this->contact->setNoEmail($this->contact->no_email); $this->contact->setNoEmail($this->contact->no_email);
} }