From 432d45e1229144920bce7d4a4dc875a3d38d2949 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 23 Dec 2022 11:27:15 +0200 Subject: [PATCH 1/5] lead capture is invalid fix --- application/Espo/Services/LeadCapture.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/application/Espo/Services/LeadCapture.php b/application/Espo/Services/LeadCapture.php index 0910cf60eb..685531f0b7 100644 --- a/application/Espo/Services/LeadCapture.php +++ b/application/Espo/Services/LeadCapture.php @@ -73,6 +73,8 @@ class LeadCapture extends Record $attributeIgnoreList = [ 'emailAddressIsOptedOut', 'phoneNumberIsOptedOut', + 'emailAddressIsInvalid', + 'phoneNumberIsInvalid', 'emailAddressData', 'phoneNumberData', ]; From a97c642d3bf57f39b9781b38f45d18ea095885ca Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 23 Dec 2022 11:29:50 +0200 Subject: [PATCH 2/5] fix --- application/Espo/Tools/App/LanguageService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/Espo/Tools/App/LanguageService.php b/application/Espo/Tools/App/LanguageService.php index aba919045f..f130f1b613 100644 --- a/application/Espo/Tools/App/LanguageService.php +++ b/application/Espo/Tools/App/LanguageService.php @@ -177,15 +177,15 @@ class LanguageService */ private function unsetEmpty(array &$data, string $scope): void { - if ($data[$scope]['options'] === []) { + if (($data[$scope]['options'] ?? null) === []) { unset($data[$scope]['options']); } - if ($data[$scope]['fields'] === []) { + if (($data[$scope]['fields'] ?? null) === []) { unset($data[$scope]['fields']); } - if ($data[$scope]['links'] === []) { + if (($data[$scope]['links'] ?? null) === []) { unset($data[$scope]['links']); } } From 686219c60b5de5d998b18886e3004d6c2887d323 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Fri, 23 Dec 2022 22:05:04 +0200 Subject: [PATCH 3/5] fix btn add radous --- client/src/views/main.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/client/src/views/main.js b/client/src/views/main.js index 54bd6c1e1c..81378c628c 100644 --- a/client/src/views/main.js +++ b/client/src/views/main.js @@ -403,14 +403,18 @@ define('views/main', ['view'], function (Dep) { this.menu[type][method](item); if (!doNotReRender && this.isRendered()) { - this.getHeaderView().reRender(); + this.getHeaderView() + .reRender() + .then(() => this.adjustButtons()); return; } if (!doNotReRender && this.isBeingRendered()) { this.once('after:render', () => { - this.getHeaderView().reRender(); + this.getHeaderView() + .reRender() + .then(() => this.adjustButtons()); }); } }, @@ -441,14 +445,20 @@ define('views/main', ['view'], function (Dep) { } if (!doNotReRender && this.isRendered()) { - this.getHeaderView().reRender(); + this.getHeaderView() + .reRender() + .reRender() + .then(() => this.adjustButtons()); return; } if (!doNotReRender && this.isBeingRendered()) { this.once('after:render', () => { - this.getHeaderView().reRender(); + this.getHeaderView() + .reRender() + .then(() => this.adjustButtons()); + }); return; From e1eaeab938bef8101dcbe3caa063877406ab5427 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 24 Dec 2022 11:03:42 +0200 Subject: [PATCH 4/5] fix import null related name --- application/Espo/Tools/Import/Import.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/application/Espo/Tools/Import/Import.php b/application/Espo/Tools/Import/Import.php index a842fa9aaa..546c74bece 100644 --- a/application/Espo/Tools/Import/Import.php +++ b/application/Espo/Tools/Import/Import.php @@ -630,6 +630,12 @@ class Import private function processForeignName(CoreEntity $entity, string $attribute): void { + $nameValue = $entity->get($attribute); + + if ($nameValue === null) { + return; + } + $relation = $entity->getAttributeParam($attribute, 'relation'); if (!$relation) { @@ -671,8 +677,6 @@ class Import return; } - $nameValue = $entity->get($attribute); - if ($isPerson) { $where = $this->parsePersonName($nameValue, $this->params->getPersonNameFormat() ?? ''); } From 4dec6b8d49a2ebca2f21f4e180f158b1d517a38c Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sat, 24 Dec 2022 11:04:03 +0200 Subject: [PATCH 5/5] import task date completed --- .../Modules/Crm/Hooks/Task/DateCompleted.php | 69 +++++++++++++++++++ .../Espo/Modules/Crm/Repositories/Task.php | 9 --- 2 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 application/Espo/Modules/Crm/Hooks/Task/DateCompleted.php diff --git a/application/Espo/Modules/Crm/Hooks/Task/DateCompleted.php b/application/Espo/Modules/Crm/Hooks/Task/DateCompleted.php new file mode 100644 index 0000000000..64c9936929 --- /dev/null +++ b/application/Espo/Modules/Crm/Hooks/Task/DateCompleted.php @@ -0,0 +1,69 @@ + $options + */ + public function beforeSave(Entity $entity, array $options): void + { + if (!$entity->isAttributeChanged(self::FIELD_STATUS)) { + return; + } + + if ( + ($options[SaveOption::IMPORT] ?? false) && + $entity->get(self::FIELD_DATE_COMPLETED) + ) { + return; + } + + if ($entity->getStatus() !== Task::STATUS_COMPLETED) { + $entity->set(self::FIELD_DATE_COMPLETED, null); + + return; + } + + $entity->setValueObject(self::FIELD_DATE_COMPLETED, DateTime::createNow()); + } +} diff --git a/application/Espo/Modules/Crm/Repositories/Task.php b/application/Espo/Modules/Crm/Repositories/Task.php index e76263eea3..de078fcc51 100644 --- a/application/Espo/Modules/Crm/Repositories/Task.php +++ b/application/Espo/Modules/Crm/Repositories/Task.php @@ -29,7 +29,6 @@ namespace Espo\Modules\Crm\Repositories; -use Espo\Core\Utils\DateTime; use Espo\Modules\Crm\Entities\Account as AccountEntity; use Espo\Modules\Crm\Entities\Contact as ContactEntity; use Espo\Modules\Crm\Entities\Lead as LeadEntity; @@ -50,14 +49,6 @@ class Task extends EventRepository */ protected function beforeSave(Entity $entity, array $options = []) { - if ($entity->isAttributeChanged('status')) { - if ($entity->get('status') == TaskEntity::STATUS_COMPLETED) { - $entity->set('dateCompleted', date(DateTime::SYSTEM_DATE_TIME_FORMAT)); - } else { - $entity->set('dateCompleted', null); - } - } - if (!$entity->isNew() && $entity->isAttributeChanged('parentId')) { $entity->set('accountId', null); $entity->set('contactId', null);