Merge branch 'hotfix/2.4.1'

This commit is contained in:
Yuri Kuznetsov
2014-08-21 18:14:30 +03:00
4 changed files with 32 additions and 12 deletions
+13 -11
View File
@@ -201,23 +201,21 @@ class Sender
$body = new MimeMessage;
$parts = array();
$bodyPart = new MimePart($email->getBodyPlainForSending());
$bodyPart->type = 'text/plain';
$bodyPart->charset = 'utf-8';
$parts[] = $bodyPart;
if ($email->get('isHtml')) {
$bodyPart = new MimePart($email->getBodyForSending());
$bodyPart->type = 'text/html';
$bodyPart->charset = 'utf-8';
} else {
if ($email->get('bodyPlain')) {
$bodyPart = new MimePart($email->get('bodyPlain'));
} else {
$bodyPart = new MimePart($email->get('body'));
}
$bodyPart->type = 'text/plain';
$bodyPart->charset = 'utf-8';
$parts[] = $bodyPart;
}
$parts[] = $bodyPart;
$aCollection = $email->get('attachments');
if (!empty($aCollection)) {
@@ -251,6 +249,10 @@ class Sender
$body->setParts($parts);
$message->setBody($body);
if ($email->get('isHtml')) {
$message->getHeaders()->get('content-type')->setType('multipart/alternative');
}
try {
$this->transport->send($message);
+16
View File
@@ -46,6 +46,21 @@ class Email extends \Espo\Core\ORM\Entity
}
}
public function getBodyPlainForSending()
{
$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 getBodyForSending()
{
$body = $this->get('body');
@@ -55,6 +70,7 @@ class Email extends \Espo\Core\ORM\Entity
$body = str_replace("?entryPoint=attachment&amp;id={$attachment->id}", "cid:{$attachment->id}", $body);
}
}
$body = str_replace("<table class=\"table table-bordered\">", "<table class=\"table table-bordered\" width=\"100%\">", $body);
return $body;
@@ -71,7 +71,8 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
$.ajax({
url: 'Admin/action/uploadUpgradePackage',
type: 'POST',
contentType: 'application/zip',
contentType: 'application/zip',
timeout: 0,
data: this.packageContents,
error: function (xhr, t, e) {
this.showError(xhr.getResponseHeader('X-Status-Reason'));
@@ -289,6 +289,7 @@ Espo.define('Views.Import.Step2', 'View', function (Dep) {
url: 'Import/action/uploadFile',
contentType: 'text/csv',
data: this.getParentView().fileContents,
timeout: 0,
success: function (data) {
if (data.attachmentId) {
this.runImport(data.attachmentId);