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

This commit is contained in:
Yuri Kuznetsov
2020-03-09 16:19:21 +02:00
5 changed files with 37 additions and 17 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}}
`,
+8 -6
View File
@@ -68,12 +68,14 @@ if ($installerConfig->get('isInstalled')) {
exit;
}
if (!$installerConfig->get('cliSessionId')) {
session_start();
$installerConfig->set('cliSessionId', session_id());
$installerConfig->save();
} else {
session_id($installerConfig->get('cliSessionId'));
if (session_status() != \PHP_SESSION_ACTIVE) {
if (!$installerConfig->get('cliSessionId')) {
session_start();
$installerConfig->set('cliSessionId', session_id());
$installerConfig->save();
} else {
session_id($installerConfig->get('cliSessionId'));
}
}
ob_start();
+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', [