get('name');
}
protected function _setSubject($value)
{
$this->set('name', $value);
}
protected function _hasSubject()
{
return $this->has('name');
}
protected function _setIsRead($value)
{
$this->setValue('isRead', $value !== false);
if ($value === true || $value === false) {
$this->setValue('isUsers', true);
} else {
$this->setValue('isUsers', false);
}
}
public function isManuallyArchived()
{
return $this->get('status') === 'Archived' && $this->get('createdById') !== 'system';
}
public function addAttachment(\Espo\Entities\Attachment $attachment)
{
if (!empty($this->id)) {
$attachment->set('parentId', $this->id);
$attachment->set('parentType', 'Email');
if ($this->entityManager->saveEntity($attachment)) {
return true;
}
}
}
public function getBodyPlain()
{
$bodyPlain = $this->get('bodyPlain');
if (!empty($bodyPlain)) {
return $bodyPlain;
}
$body = $this->get('body');
$breaks = array("
","
","
","
","<br />","<br/>","<br>");
$body = str_ireplace($breaks, "\r\n", $body);
$body = strip_tags($body);
return $body;
}
public function getBodyPlainForSending()
{
return $this->getBodyPlain();
}
public function getBodyForSending()
{
$body = $this->get('body');
if (!empty($body)) {
$attachmentList = $this->getInlineAttachments();
foreach ($attachmentList as $attachment) {
$body = str_replace("?entryPoint=attachment&id={$attachment->id}", "cid:{$attachment->id}", $body);
}
}
$body = str_replace("