Compare commits

...

7 Commits
8.1.2 ... 8.1.4

Author SHA1 Message Date
Yuri Kuznetsov
db26c579b0 8.1.4 2024-02-07 11:35:44 +02:00
Yuri Kuznetsov
623b26f60f email phone fields save fix 2024-02-07 09:42:59 +02:00
Yuri Kuznetsov
fec6bf8ee0 mass email link checker 2024-02-07 09:01:56 +02:00
Yuri Kuznetsov
f5a655b9fc markdlow blockquote fix 2024-02-02 16:30:08 +02:00
Yuri Kuznetsov
1a5abe6363 calendar fix is today 2024-02-02 16:09:34 +02:00
Yuri Kuznetsov
aced5fcab9 8.1.3 2024-02-01 16:14:48 +02:00
Yuri Kuznetsov
f786690f1e markdown fix 2024-02-01 15:58:10 +02:00
10 changed files with 113 additions and 22 deletions

View File

@@ -69,7 +69,7 @@ class Saver implements SaverInterface
$emailAddressData = $entity->get('emailAddressData');
}
if ($emailAddressData !== null) {
if ($emailAddressData !== null && $entity->isAttributeChanged('emailAddressData')) {
$this->storeData($entity);
return;

View File

@@ -74,7 +74,7 @@ class Saver implements SaverInterface
$phoneNumberData = $entity->get('phoneNumberData');
}
if ($phoneNumberData !== null) {
if ($phoneNumberData !== null && $entity->isAttributeChanged('phoneNumberData')) {
$this->storeData($entity);
return;

View File

@@ -0,0 +1,48 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2024 Yurii Kuznietsov, Taras Machyshyn, Oleksii Avramenko
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
namespace Espo\Modules\Crm\Classes\Acl\MassEmail\LinkCheckers;
use Espo\Core\Acl\LinkChecker;
use Espo\Entities\InboundEmail;
use Espo\Entities\User;
use Espo\Modules\Crm\Entities\MassEmail;
use Espo\ORM\Entity;
/**
* @implements LinkChecker<MassEmail, InboundEmail>
* @noinspection PhpUnused
*/
class InboundEmailLinkChecker implements LinkChecker
{
public function check(User $user, Entity $entity, Entity $foreignEntity): bool
{
return $foreignEntity->smtpIsForMassEmail();
}
}

View File

@@ -1,3 +1,6 @@
{
"ownershipCheckerClassName": "Espo\\Modules\\Crm\\Classes\\Acl\\MassEmail\\OwnershipChecker"
"ownershipCheckerClassName": "Espo\\Modules\\Crm\\Classes\\Acl\\MassEmail\\OwnershipChecker",
"linkCheckerClassNameMap": {
"inboundEmail": "Espo\\Modules\\Crm\\Classes\\Acl\\MassEmail\\LinkCheckers\\InboundEmailLinkChecker"
}
}

View File

@@ -365,7 +365,7 @@ class CalendarView extends View {
const todayUnix = moment().unix();
const startUnix = moment(view.activeStart).unix();
const endUnix = moment(view.activeStart).unix();
const endUnix = moment(view.activeEnd).unix();
return startUnix <= todayUnix && todayUnix < endUnix;
}

View File

@@ -42,16 +42,18 @@ class ViewHelper {
/** @private */
this.mdBeforeList = [
{
regex: /&#x60;&#x60;&#x60;\n?([\s\S]*?)&#x60;&#x60;&#x60;/g,
/*{
regex: /```\n?([\s\S]*?)```/g,
value: (s, string) => {
return '```\n' + string + '```';
return '```\n' + string.replace(/\\\>/g, '>') + '```';
},
},
},*/
{
regex: /&#x60;([\s\S]*?)&#x60;/g,
// Also covers triple-backtick blocks.
regex: /`([\s\S]*?)`/g,
value: (s, string) => {
return '`' + string + '`';
// noinspection RegExpRedundantEscape
return '`' + string.replace(/\\\</g, '<') + '`';
},
},
];
@@ -689,7 +691,8 @@ class ViewHelper {
transformMarkdownText(text, options) {
text = text || '';
text = Handlebars.Utils.escapeExpression(text).replace(/&gt;+/g, '>');
// noinspection RegExpRedundantEscape
text = text.replace(/\</g, '\\<');
this.mdBeforeList.forEach(item => {
text = text.replace(item.regex, item.value);
@@ -697,12 +700,9 @@ class ViewHelper {
options = options || {};
if (options.inline) {
text = marked.parseInline(text);
}
else {
text = marked.parse(text);
}
text = options.inline ?
marked.parseInline(text) :
marked.parse(text);
text = DOMPurify.sanitize(text, {}).toString();

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "espocrm",
"version": "8.1.2",
"version": "8.1.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "espocrm",
"version": "8.1.2",
"version": "8.1.4",
"hasInstallScript": true,
"license": "AGPL-3.0-or-later",
"dependencies": {

View File

@@ -1,6 +1,6 @@
{
"name": "espocrm",
"version": "8.1.2",
"version": "8.1.4",
"description": "Open-source CRM.",
"repository": {
"type": "git",

View File

@@ -31,10 +31,12 @@ namespace tests\integration\Espo\Core\FieldProcessing;
use Espo\Core\ORM\EntityManager;
use Espo\Modules\Crm\Entities\Contact;
use Espo\Core\{
Field\EmailAddressGroup,
Field\EmailAddress,
};
Record\ServiceContainer,
Record\UpdateParams};
class EmailAddressTest extends \tests\integration\Core\BaseTestCase
{
@@ -120,4 +122,22 @@ class EmailAddressTest extends \tests\integration\Core\BaseTestCase
$this->assertEquals('test@test.com', $group->getPrimary()->getAddress());
}
public function testEmailAddress3(): void
{
$service = $this->getContainer()->getByClass(ServiceContainer::class)->getByClass(Contact::class);
$em = $this->getEntityManager();
/** @var Contact $contact */
$contact = $em->createEntity(Contact::ENTITY_TYPE);
/** @noinspection PhpUnhandledExceptionInspection */
$service->update($contact->getId(), (object) [
'emailAddress' => 'test@test.com',
], UpdateParams::create());
$em->refreshEntity($contact);
$this->assertEquals('test@test.com', $contact->getEmailAddress());
}
}

View File

@@ -31,10 +31,12 @@ namespace tests\integration\Espo\Core\FieldProcessing;
use Espo\Core\ORM\EntityManager;
use Espo\Modules\Crm\Entities\Contact;
use Espo\Core\{
Field\PhoneNumberGroup,
Field\PhoneNumber,
};
Record\ServiceContainer,
Record\UpdateParams};
class PhoneNumberTest extends \tests\integration\Core\BaseTestCase
{
@@ -99,4 +101,22 @@ class PhoneNumberTest extends \tests\integration\Core\BaseTestCase
$this->assertEquals(1, $group5->getCount());
}
public function testPhoneNumber2(): void
{
$service = $this->getContainer()->getByClass(ServiceContainer::class)->getByClass(Contact::class);
$em = $this->getEntityManager();
/** @var Contact $contact */
$contact = $em->createEntity(Contact::ENTITY_TYPE);
/** @noinspection PhpUnhandledExceptionInspection */
$service->update($contact->getId(), (object) [
'phoneNumber' => '+11111111111',
], UpdateParams::create());
$em->refreshEntity($contact);
$this->assertEquals('+11111111111', $contact->getPhoneNumber());
}
}