New can view and set no_email for contacts

This commit is contained in:
ptibogxiv 2022-08-20 13:16:04 +02:00 committed by GitHub
parent f95612d9a5
commit e8faeabbe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,6 +96,10 @@ class Contacts extends DolibarrApi
if ($includeroles) {
$this->contact->fetchRoles();
}
if (isModEnabled('mailing')) {
$this->contact->getNoEmail();
}
return $this->_cleanObjectDatas($this->contact);
}
@ -140,6 +144,10 @@ class Contacts extends DolibarrApi
if ($includeroles) {
$this->contact->fetchRoles();
}
if (isModEnabled('mailing')) {
$this->contact->getNoEmail();
}
return $this->_cleanObjectDatas($this->contact);
}
@ -250,6 +258,9 @@ class Contacts extends DolibarrApi
if ($includeroles) {
$contact_static->fetchRoles();
}
if (isModEnabled('mailing')) {
$contact_static->getNoEmail();
}
$obj_ret[] = $this->_cleanObjectDatas($contact_static);
}
@ -285,6 +296,9 @@ class Contacts extends DolibarrApi
if ($this->contact->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, "Error creating contact", array_merge(array($this->contact->error), $this->contact->errors));
}
if (isModEnabled('mailing') && !empty($this->contact->email)) {
$this->contact->setNoEmail($this->contact->no_email);
}
return $this->contact->id;
}
@ -316,6 +330,10 @@ class Contacts extends DolibarrApi
}
$this->contact->$field = $value;
}
if (isModEnabled('mailing') && !empty($this->contact->email)) {
$this->contact->setNoEmail($this->contact->no_email);
}
if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) {
return $this->get($id);