From ffe83d24ce16b528b9decace80aadef3b984ac2b Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 5 Mar 2020 11:53:16 +0200 Subject: [PATCH 1/6] compose email: skip appending initial body if changed --- client/src/views/email/record/compose.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/views/email/record/compose.js b/client/src/views/email/record/compose.js index adfa476109..188461b8bb 100644 --- a/client/src/views/email/record/compose.js +++ b/client/src/views/email/record/compose.js @@ -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) { From 5e3f00f11d401b77554e66356c2850c13b47dccf Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Thu, 5 Mar 2020 12:40:07 +0200 Subject: [PATCH 2/6] tootltip link in new tab --- client/src/view-helper.js | 4 ++++ client/src/views/fields/base.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/client/src/view-helper.js b/client/src/view-helper.js index 6595f11ca3..3901ed54a2 100644 --- a/client/src/view-helper.js +++ b/client/src/view-helper.js @@ -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(/ Date: Thu, 5 Mar 2020 16:28:16 +0200 Subject: [PATCH 3/6] page title update fix --- client/src/views/detail.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/views/detail.js b/client/src/views/detail.js index ab32242e20..68338ab697 100644 --- a/client/src/views/detail.js +++ b/client/src/views/detail.js @@ -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); }, From ec4afe0e11d3c55b332d5bd99fa1d31c6d06de9d Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 6 Mar 2020 12:48:45 +0200 Subject: [PATCH 4/6] foreign concat name null if empty --- application/Espo/ORM/DB/Query/Base.php | 4 +++- tests/unit/Espo/ORM/DB/MapperTest.php | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/application/Espo/ORM/DB/Query/Base.php b/application/Espo/ORM/DB/Query/Base.php index 679b465e0f..9259e152c8 100644 --- a/application/Espo/ORM/DB/Query/Base.php +++ b/application/Espo/ORM/DB/Query/Base.php @@ -1401,8 +1401,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); diff --git a/tests/unit/Espo/ORM/DB/MapperTest.php b/tests/unit/Espo/ORM/DB/MapperTest.php index 02e7be8d6d..9deef2a34c 100644 --- a/tests/unit/Espo/ORM/DB/MapperTest.php +++ b/tests/unit/Espo/ORM/DB/MapperTest.php @@ -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' ". From 770cac9b87c16aebe93b8fa67f34c99bb1408c7d Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 6 Mar 2020 13:02:39 +0200 Subject: [PATCH 5/6] orm: IFNULL, NULLIF functions --- application/Espo/ORM/DB/Query/Base.php | 4 ++++ tests/unit/Espo/ORM/DB/QueryTest.php | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/application/Espo/ORM/DB/Query/Base.php b/application/Espo/ORM/DB/Query/Base.php index 9259e152c8..2afce2c0a7 100644 --- a/application/Espo/ORM/DB/Query/Base.php +++ b/application/Espo/ORM/DB/Query/Base.php @@ -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', diff --git a/tests/unit/Espo/ORM/DB/QueryTest.php b/tests/unit/Espo/ORM/DB/QueryTest.php index b11b202b86..5b7f9e89bb 100644 --- a/tests/unit/Espo/ORM/DB/QueryTest.php +++ b/tests/unit/Espo/ORM/DB/QueryTest.php @@ -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', [ From 3159181c5c689c917a81f805f6c00ef91b706971 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 6 Mar 2020 13:26:35 +0200 Subject: [PATCH 6/6] acceptance status modal change --- .../src/views/meeting/modals/acceptance-status.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/client/modules/crm/src/views/meeting/modals/acceptance-status.js b/client/modules/crm/src/views/meeting/modals/acceptance-status.js index 4e57ea3cda..0e744646f7 100644 --- a/client/modules/crm/src/views/meeting/modals/acceptance-status.js +++ b/client/modules/crm/src/views/meeting/modals/acceptance-status.js @@ -35,13 +35,14 @@ define('crm:views/meeting/modals/acceptance-status', 'views/modal', function (De templateContent: `

{{viewObject.message}}

{{#each viewObject.statusDataList}} -

- -

+
+
+ + {{#if selected}}{{/if}} +
+
{{/each}} `,