Merge branch 'hotfix/5.8.3' of ssh://172.20.0.1/var/git/espo/backend into hotfix/5.8.3

This commit is contained in:
Taras Machyshyn
2020-03-09 16:19:07 +02:00
8 changed files with 48 additions and 14 deletions
+7 -1
View File
@@ -162,6 +162,8 @@ abstract class Base
'NOT',
'IN',
'NOT_IN',
'IFNULL',
'NULLIF',
'BINARY',
'UNIX_TIMESTAMP',
'TIMESTAMPDIFF_DAY',
@@ -195,6 +197,8 @@ abstract class Base
'MUL',
'DIV',
'MOD',
'IFNULL',
'NULLIF',
'TIMESTAMPDIFF_DAY',
'TIMESTAMPDIFF_MONTH',
'TIMESTAMPDIFF_YEAR',
@@ -1401,8 +1405,10 @@ abstract class Base
$fieldPath = 'TRIM(CONCAT(' . implode(', ', $foreign). '))';
if ($wsCount > 1) {
$fieldPath = "REPLACE({$fieldPath}, ' ', ' ')";
$fieldPath = "REPLACE({$fieldPath}, ' ', ' ')";
}
$fieldPath = "NULLIF({$fieldPath}, '')";
} else {
$expression = $this->getAlias($entity, $relationName) . '.' . $foreign;
$fieldPath = $this->convertComplexExpression($entity, $expression, false, $params);
@@ -35,13 +35,14 @@ define('crm:views/meeting/modals/acceptance-status', 'views/modal', function (De
templateContent: `
<p>{{viewObject.message}}</p>
{{#each viewObject.statusDataList}}
<p>
<button class="action btn btn-{{style}} btn-x-wide" type="button" data-action="setStatus" data-status="{{name}}">
{{#if selected}}<span style="text-decoration: underline;">{{/if}}
{{label}}
{{#if selected}}</span>{{/if}}
</button>
</p>
<div class="margin-bottom">
<div>
<button class="action btn btn-{{style}} btn-x-wide" type="button" data-action="setStatus" data-status="{{name}}">
{{label}}
</button>
{{#if selected}}<span class="check-icon fas fa-check" style="vertical-align: middle; margin: 0 10px;"></span>{{/if}}
</div>
</div>
{{/each}}
`,
+4
View File
@@ -333,6 +333,10 @@ define('view-helper', ['lib!client/lib/purify.min.js'], function () {
text = DOMPurify.sanitize(text).toString();
if (options.linksInNewTab) {
text = text.replace(/<a href=/gm, '<a target="_blank" rel="noopener noreferrer" href=');
}
text = text.replace(/<a href="mailto:(.*)"/gm, '<a href="javascript:" data-email-address="$1" data-action="mailTo"');
return new Handlebars.SafeString(text);
+13 -1
View File
@@ -74,6 +74,8 @@ define('views/detail', 'views/main', function (Dep) {
this.setupHeader();
this.setupRecord();
this.setupPageTitle();
if (this.getMetadata().get('scopes.' + this.scope + '.stream')) {
if (this.model.has('isFollowed')) {
this.handleFollowButton();
@@ -85,6 +87,17 @@ define('views/detail', 'views/main', function (Dep) {
}
},
setupPageTitle: function () {
this.listenTo(this.model, 'after:save', function () {
this.updatePageTitle();
}, this);
this.listenTo(this.model, 'sync', function (model) {
if (model && model.hasChanged('name')) {
this.updatePageTitle();
}
}, this);
},
setupHeader: function () {
this.createView('header', this.headerView, {
model: this.model,
@@ -98,7 +111,6 @@ define('views/detail', 'views/main', function (Dep) {
if (this.getView('header')) {
this.getView('header').reRender();
}
this.updatePageTitle();
}
}, this);
},
+1 -1
View File
@@ -109,7 +109,7 @@ define('views/email/record/compose', ['views/record/edit', 'views/email/record/d
body = this.appendSignature(body || '', data.isHtml);
}
if (this.initialBody) {
if (this.initialBody && !this.isBodyChanged) {
var initialBody = this.initialBody;
if (data.isHtml !== this.initialIsHtml) {
if (data.isHtml) {
+1 -1
View File
@@ -381,7 +381,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
}
tooltipText = tooltipText || this.translate(this.name, 'tooltips', this.model.name) || '';
tooltipText = this.getHelper().transfromMarkdownText(tooltipText).toString();
tooltipText = this.getHelper().transfromMarkdownText(tooltipText, {linksInNewTab: true}).toString();
$a.popover({
placement: 'bottom',
+3 -3
View File
@@ -120,7 +120,7 @@ class DBMapperTest extends \PHPUnit\Framework\TestCase
public function testSelectById()
{
$query =
"SELECT post.id AS `id`, post.name AS `name`, TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))) AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"SELECT post.id AS `id`, post.name AS `name`, NULLIF(TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))), '') AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"FROM `post` ".
"LEFT JOIN `user` AS `createdBy` ON post.created_by_id = createdBy.id " .
"WHERE post.id = '1' AND post.deleted = '0'";
@@ -140,7 +140,7 @@ class DBMapperTest extends \PHPUnit\Framework\TestCase
public function testSelect()
{
$query =
"SELECT post.id AS `id`, post.name AS `name`, TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))) AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"SELECT post.id AS `id`, post.name AS `name`, NULLIF(TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))), '') AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"FROM `post` ".
"LEFT JOIN `user` AS `createdBy` ON post.created_by_id = createdBy.id " .
"JOIN `post_tag` AS `tagsMiddle` ON post.id = tagsMiddle.post_id AND tagsMiddle.deleted = '0' ".
@@ -290,7 +290,7 @@ class DBMapperTest extends \PHPUnit\Framework\TestCase
public function testSelectRelatedBelongsTo()
{
$query =
"SELECT post.id AS `id`, post.name AS `name`, TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))) AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"SELECT post.id AS `id`, post.name AS `name`, NULLIF(TRIM(CONCAT(IFNULL(createdBy.salutation_name, ''), IFNULL(createdBy.first_name, ''), ' ', IFNULL(createdBy.last_name, ''))), '') AS `createdByName`, post.created_by_id AS `createdById`, post.deleted AS `deleted` ".
"FROM `post` ".
"LEFT JOIN `user` AS `createdBy` ON post.created_by_id = createdBy.id " .
"WHERE post.id = '1' AND post.deleted = '0' ".
+11
View File
@@ -764,6 +764,17 @@ class QueryTest extends \PHPUnit\Framework\TestCase
$this->assertEquals($expectedSql, $sql);
}
public function testFunction18()
{
$sql = $this->query->createSelectQuery('Comment', [
'select' => [["IFNULL:(name, '')", 'test']],
'withDeleted' => true
]);
$expectedSql =
"SELECT IFNULL(comment.name, '') AS `test` FROM `comment`";
$this->assertEquals($expectedSql, $sql);
}
public function testFunctionTZ1()
{
$sql = $this->query->createSelectQuery('Comment', [