This commit is contained in:
Yuri Kuznetsov
2025-05-03 17:11:37 +03:00
parent 44c3aa0f19
commit def0bbd55e
4 changed files with 67 additions and 11 deletions

View File

@@ -52,11 +52,6 @@ class AddressDataLoader implements Loader
/** @var EmailRepository $repository */
$repository = $this->entityManager->getRepository(Email::ENTITY_TYPE);
$repository->loadFromField($entity);
$repository->loadToField($entity);
$repository->loadCcField($entity);
$repository->loadBccField($entity);
$repository->loadReplyToField($entity);
$repository->loadNameHash($entity);
}
}

View File

@@ -0,0 +1,60 @@
<?php
/************************************************************************
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 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\Classes\FieldProcessing\Email;
use Espo\Core\FieldProcessing\Loader;
use Espo\Core\FieldProcessing\Loader\Params;
use Espo\Core\ORM\EntityManager;
use Espo\Entities\Email;
use Espo\ORM\Entity;
use Espo\Repositories\Email as EmailRepository;
/**
* @implements Loader<Email>
*/
class AddressLoader implements Loader
{
public function __construct(private EntityManager $entityManager)
{}
/**
* @inheritDoc
*/
public function process(Entity $entity, Params $params): void
{
/** @var EmailRepository $repository */
$repository = $this->entityManager->getRepository(Email::ENTITY_TYPE);
$repository->loadFromField($entity);
$repository->loadToField($entity);
$repository->loadCcField($entity);
$repository->loadBccField($entity);
$repository->loadReplyToField($entity);
}
}

View File

@@ -94,7 +94,7 @@
"filters"
],
"massUpdateDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader"
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressLoader"
},
"to": {
"type": "varchar",
@@ -102,7 +102,7 @@
"orderDisabled": true,
"required": true,
"view": "views/email/fields/email-address-varchar",
"validatorClassName": "Espo\\Classes\\FieldValidators\\Email\\EmailAddresses",
"validatorClassName": "Espo\\Classes\\FieldValidators\\Email\\AddressLoader",
"validatorClassNameList": [
"Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid",
"Espo\\Classes\\FieldValidators\\Email\\Addresses\\MaxCount"
@@ -114,7 +114,7 @@
"filters"
],
"massUpdateDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader"
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressLoader"
},
"cc": {
"type": "varchar",
@@ -132,7 +132,7 @@
"filters"
],
"massUpdateDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader"
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressLoader"
},
"bcc": {
"type": "varchar",
@@ -149,7 +149,7 @@
"detail"
],
"massUpdateDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader"
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressLoader"
},
"replyTo": {
"type": "varchar",
@@ -162,7 +162,7 @@
"detail"
],
"massUpdateDisabled": true,
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader"
"loaderClassName": "Espo\\Classes\\FieldProcessing\\Email\\AddressLoader"
},
"personStringData": {
"type": "varchar",

View File

@@ -1,6 +1,7 @@
{
"loadAdditionalFieldsAfterUpdate": true,
"readLoaderClassNameList": [
"Espo\\Classes\\FieldProcessing\\Email\\AddressLoader",
"Espo\\Classes\\FieldProcessing\\Email\\AddressDataLoader",
"Espo\\Classes\\FieldProcessing\\Email\\UserColumnsLoader",
"Espo\\Classes\\FieldProcessing\\Email\\FolderDataLoader",