Merge pull request #21815 from ptibogxiv/patch-39
New can view and set no_email for contacts with API
This commit is contained in:
commit
ec375f99f8
@ -97,6 +97,10 @@ class Contacts extends DolibarrApi
|
||||
$this->contact->fetchRoles();
|
||||
}
|
||||
|
||||
if (isModEnabled('mailing')) {
|
||||
$this->contact->getNoEmail();
|
||||
}
|
||||
|
||||
return $this->_cleanObjectDatas($this->contact);
|
||||
}
|
||||
|
||||
@ -141,6 +145,10 @@ class Contacts extends DolibarrApi
|
||||
$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) && isset($this->contact->no_email)) {
|
||||
$this->contact->setNoEmail($this->contact->no_email);
|
||||
}
|
||||
return $this->contact->id;
|
||||
}
|
||||
|
||||
@ -317,6 +331,10 @@ class Contacts extends DolibarrApi
|
||||
$this->contact->$field = $value;
|
||||
}
|
||||
|
||||
if (isModEnabled('mailing') && !empty($this->contact->email) && isset($this->contact->no_email)) {
|
||||
$this->contact->setNoEmail($this->contact->no_email);
|
||||
}
|
||||
|
||||
if ($this->contact->update($id, DolibarrApiAccess::$user, 1, '', '', 'update')) {
|
||||
return $this->get($id);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user