email to case little change

This commit is contained in:
Yuri Kuznetsov
2014-10-30 16:22:26 +02:00
parent 4f0a1a3fe1
commit 7fa5b30ae9
3 changed files with 20 additions and 0 deletions
+15
View File
@@ -46,6 +46,21 @@ class Email extends \Espo\Core\ORM\Entity
}
}
public function getBodyPlain()
{
$bodyPlain = $this->get('bodyPlain');
if (!empty($bodyPlain)) {
return $bodyPlain;
}
$body = $this->get('body');
$breaks = array("<br />","<br>","<br/>","<br />","&lt;br /&gt;","&lt;br/&gt;","&lt;br&gt;");
$body = str_ireplace($breaks, "\r\n", $body);
$body = strip_tags($body);
return $body;
}
public function getBodyPlainForSending()
{
$bodyPlain = $this->get('bodyPlain');
@@ -262,6 +262,7 @@ class InboundEmail extends \Espo\Services\Record
'userId' => $inboundEmail->get('assignToUserId'),
);
$case = $this->emailToCase($email, $params);
$this->getServiceFactory()->create('Stream')->noteEmailReceived($case, $email);
$user = $this->getEntityManager()->getEntity('User', $case->get('assignedUserId'));
if ($inboundEmail->get('reply')) {
$this->autoReply($inboundEmail, $email, $case, $user);
+4
View File
@@ -272,6 +272,10 @@ class Stream extends \Espo\Core\Services\Base
$note->set('type', 'EmailReceived');
$note->set('parentId', $entity->id);
$note->set('parentType', $entityName);
$bodyPlain = $email->getBodyPlain();
$note->set('post', $email->get)
$data = array();