mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
fieldUtil usage
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Espo\Core\Acl;
|
||||
use Espo\Core\{
|
||||
Utils\Metadata,
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -62,16 +62,16 @@ class GlobalRestricton
|
||||
|
||||
private $fileManager;
|
||||
|
||||
private $fieldManagerUtil;
|
||||
private $fieldUtil;
|
||||
|
||||
private $data;
|
||||
|
||||
public function __construct(
|
||||
Metadata $metadata, FileManager $fileManager, FieldManagerUtil $fieldManagerUtil, bool $useCache = true
|
||||
Metadata $metadata, FileManager $fileManager, FieldUtil $fieldUtil, bool $useCache = true
|
||||
) {
|
||||
$this->metadata = $metadata;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
|
||||
$isFromCache = false;
|
||||
|
||||
@@ -129,7 +129,7 @@ class GlobalRestricton
|
||||
if ($this->getMetadata()->get(['entityAcl', $scope, 'fields', $field, $type])) {
|
||||
$isNotEmpty = true;
|
||||
$resultFieldList[] = $field;
|
||||
$fieldAttributeList = $this->getFieldManagerUtil()->getAttributeList($scope, $field);
|
||||
$fieldAttributeList = $this->getFieldUtil()->getAttributeList($scope, $field);
|
||||
foreach ($fieldAttributeList as $attribute) {
|
||||
$resultAttributeList[] = $attribute;
|
||||
}
|
||||
@@ -168,9 +168,9 @@ class GlobalRestricton
|
||||
return $this->fileManager;
|
||||
}
|
||||
|
||||
protected function getFieldManagerUtil()
|
||||
protected function getFieldUtil()
|
||||
{
|
||||
return $this->fieldManagerUtil;
|
||||
return $this->fieldUtil;
|
||||
}
|
||||
|
||||
public function getScopeRestrictedFieldList($scope, $type)
|
||||
|
||||
@@ -38,7 +38,7 @@ use Espo\Core\{
|
||||
ORM\Entity,
|
||||
Utils\Config,
|
||||
Utils\Metadata,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
Utils\File\Manager as FileManager,
|
||||
};
|
||||
|
||||
@@ -86,7 +86,7 @@ class Table
|
||||
protected $config;
|
||||
protected $fileManager;
|
||||
protected $metadata;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
@@ -94,7 +94,7 @@ class Table
|
||||
Config $config = null,
|
||||
FileManager $fileManager = null,
|
||||
Metadata $metadata = null,
|
||||
FieldManagerUtil $fieldManagerUtil = null
|
||||
FieldUtil $fieldUtil = null
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
|
||||
@@ -114,8 +114,8 @@ class Table
|
||||
|
||||
$this->metadata = $metadata;
|
||||
|
||||
if ($fieldManagerUtil) {
|
||||
$this->fieldManager = $fieldManagerUtil;
|
||||
if ($fieldUtil) {
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
}
|
||||
|
||||
if (!$this->user->isFetched()) {
|
||||
@@ -156,9 +156,9 @@ class Table
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
protected function getFieldManager()
|
||||
protected function getFieldUtil()
|
||||
{
|
||||
return $this->fieldManager;
|
||||
return $this->fieldUtil;
|
||||
}
|
||||
|
||||
public function getMap() : StdClass
|
||||
@@ -438,7 +438,7 @@ class Table
|
||||
}
|
||||
|
||||
foreach (get_object_vars($scopeData) as $field => $fieldData) {
|
||||
$attributeList = $this->getFieldManager()->getAttributeList($scope, $field);
|
||||
$attributeList = $this->getFieldUtil()->getAttributeList($scope, $field);
|
||||
|
||||
foreach ($this->fieldActionList as $action) {
|
||||
if (!isset($fieldData->$action)) continue;
|
||||
|
||||
@@ -41,7 +41,7 @@ use Espo\Core\{
|
||||
ORM\Entity,
|
||||
Utils\Config,
|
||||
Utils\Metadata,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
Utils\File\Manager as FileManager,
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ class Table extends \Espo\Core\Acl\Table
|
||||
Config $config = null,
|
||||
FileManager $fileManager = null,
|
||||
Metadata $metadata = null,
|
||||
FieldManagerUtil $fieldManagerUtil = null
|
||||
FieldUtil $fieldUtil = null
|
||||
) {
|
||||
if (empty($portal)) {
|
||||
throw new Error("No portal was passed to AclPortal\\Table constructor.");
|
||||
@@ -74,7 +74,7 @@ class Table extends \Espo\Core\Acl\Table
|
||||
|
||||
$this->portal = $portal;
|
||||
|
||||
parent::__construct($entityManager, $user, $config, $fileManager, $metadata, $fieldManagerUtil);
|
||||
parent::__construct($entityManager, $user, $config, $fileManager, $metadata, $fieldUtil);
|
||||
}
|
||||
|
||||
protected function getPortal()
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Di;
|
||||
|
||||
use Espo\Core\Utils\FieldManagerUtil;
|
||||
use Espo\Core\Utils\FieldUtil;
|
||||
|
||||
interface FieldManagerUtilAware
|
||||
interface FieldUtilAware
|
||||
{
|
||||
public function setFieldManagerUtil(FieldManagerUtil $fieldManagerUtil);
|
||||
public function setFieldUtil(FieldUtil $fieldUtil);
|
||||
}
|
||||
@@ -29,14 +29,14 @@
|
||||
|
||||
namespace Espo\Core\Di;
|
||||
|
||||
use Espo\Core\Utils\FieldManagerUtil;
|
||||
use Espo\Core\Utils\FieldUtil;
|
||||
|
||||
trait FieldManagerUtilSetter
|
||||
trait FieldUtilSetter
|
||||
{
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
|
||||
public function setFieldManagerUtil(FieldManagerUtil $fieldManagerUtil)
|
||||
public function setFieldUtil(FieldUtil $fieldUtil)
|
||||
{
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ use Espo\Core\{
|
||||
InjectableFactory,
|
||||
Utils\Metadata,
|
||||
Utils\Config,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
ORM\EntityManager,
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ class SelectManager
|
||||
protected $aclManager;
|
||||
protected $metadata;
|
||||
protected $config;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
protected $injectableFactory;
|
||||
|
||||
public function __construct(
|
||||
@@ -109,7 +109,7 @@ class SelectManager
|
||||
AclManager $aclManager,
|
||||
Metadata $metadata,
|
||||
Config $config,
|
||||
FieldManagerUtil $fieldManagerUtil,
|
||||
FieldUtil $fieldUtil,
|
||||
InjectableFactory $injectableFactory
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
@@ -118,7 +118,7 @@ class SelectManager
|
||||
$this->aclManager = $aclManager;
|
||||
$this->metadata = $metadata;
|
||||
$this->config = $config;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
$this->injectableFactory = $injectableFactory;
|
||||
}
|
||||
|
||||
@@ -157,9 +157,9 @@ class SelectManager
|
||||
return $this->injectableFactory;
|
||||
}
|
||||
|
||||
protected function getFieldManagerUtil() : FieldManagerUtil
|
||||
protected function getFieldUtil() : FieldUtil
|
||||
{
|
||||
return $this->fieldManagerUtil;
|
||||
return $this->fieldUtil;
|
||||
}
|
||||
|
||||
public function setEntityType(string $entityType)
|
||||
@@ -2825,7 +2825,7 @@ class SelectManager
|
||||
$sortByField = $params['orderBy'] ?? $this->getMetadata()->get(['entityDefs', $this->entityType, 'collection', 'orderBy']);
|
||||
|
||||
if ($sortByField) {
|
||||
$sortByAttributeList = $this->getFieldManagerUtil()->getAttributeList($this->getEntityType(), $sortByField);
|
||||
$sortByAttributeList = $this->getFieldUtil()->getAttributeList($this->getEntityType(), $sortByField);
|
||||
foreach ($sortByAttributeList as $attribute) {
|
||||
if (!in_array($attribute, $attributeList) && $seed->hasAttribute($attribute)) {
|
||||
$attributeList[] = $attribute;
|
||||
|
||||
@@ -29,27 +29,31 @@
|
||||
|
||||
namespace Espo\Core\Utils;
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
|
||||
class FieldValidatorManager
|
||||
{
|
||||
private $metadata;
|
||||
|
||||
private $fieldManagerUtil;
|
||||
private $fieldUtil;
|
||||
|
||||
private $implHash = [];
|
||||
|
||||
public function __construct(Metadata $metadata, FieldManagerUtil $fieldManagerUtil)
|
||||
public function __construct(Metadata $metadata, FieldUtil $fieldUtil)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
}
|
||||
|
||||
public function check(\Espo\ORM\Entity $entity, string $field, string $type, $data = null) : bool
|
||||
public function check(Entity $entity, string $field, string $type, $data = null) : bool
|
||||
{
|
||||
if (!$data) $data = (object) [];
|
||||
if (!$data) {
|
||||
$data = (object) [];
|
||||
}
|
||||
|
||||
$fieldType = $this->fieldManagerUtil->getEntityTypeFieldParam($entity->getEntityType(), $field, 'type');
|
||||
$fieldType = $this->fieldUtil->getEntityTypeFieldParam($entity->getEntityType(), $field, 'type');
|
||||
|
||||
$validationValue = $this->fieldManagerUtil->getEntityTypeFieldParam($entity->getEntityType(), $field, $type);
|
||||
$validationValue = $this->fieldUtil->getEntityTypeFieldParam($entity->getEntityType(), $field, $type);
|
||||
|
||||
$mandatoryValidationList = $this->metadata->get(['fields', $fieldType, 'mandatoryValidationList'], []);
|
||||
|
||||
@@ -60,6 +64,7 @@ class FieldValidatorManager
|
||||
if (!array_key_exists($fieldType, $this->implHash)) {
|
||||
$this->loadImpl($fieldType);
|
||||
}
|
||||
|
||||
$impl = $this->implHash[$fieldType];
|
||||
|
||||
$methodName = 'check' . ucfirst($type);
|
||||
@@ -80,6 +85,6 @@ class FieldValidatorManager
|
||||
}
|
||||
}
|
||||
|
||||
$this->implHash[$fieldType] = new $className($this->metadata, $this->fieldManagerUtil);
|
||||
$this->implHash[$fieldType] = new $className($this->metadata, $this->fieldUtil);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Espo\Core\Webhook;
|
||||
use Espo\Core\{
|
||||
Utils\Config,
|
||||
Utils\File\Manager as FileManager,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
ORM\EntityManager,
|
||||
ORM\Entity,
|
||||
};
|
||||
@@ -51,18 +51,18 @@ class Manager
|
||||
protected $config;
|
||||
protected $fileManager;
|
||||
protected $entityManager;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
FileManager $fileManager,
|
||||
EntityManager $entityManager,
|
||||
FieldManagerUtil $fieldManagerUtil
|
||||
FieldUtil $fieldUtil
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
|
||||
$this->loadData();
|
||||
}
|
||||
@@ -220,11 +220,11 @@ class Manager
|
||||
$this->logDebugEvent($event, $entity);
|
||||
}
|
||||
|
||||
foreach ($this->fieldManagerUtil->getEntityTypeFieldList($entity->getEntityType()) as $field) {
|
||||
foreach ($this->fieldUtil->getEntityTypeFieldList($entity->getEntityType()) as $field) {
|
||||
$itemEvent = $entity->getEntityType() . '.fieldUpdate.' . $field;
|
||||
if (!$this->eventExists($itemEvent)) continue;
|
||||
|
||||
$attributeList = $this->fieldManagerUtil->getActualAttributeList($entity->getEntityType(), $field);
|
||||
$attributeList = $this->fieldUtil->getActualAttributeList($entity->getEntityType(), $field);
|
||||
$isChanged = false;
|
||||
foreach ($attributeList as $attribute) {
|
||||
if (in_array($attribute, $this->skipAttributeList)) continue;
|
||||
@@ -237,7 +237,7 @@ class Manager
|
||||
if ($isChanged) {
|
||||
$itemData = (object) [];
|
||||
$itemData->id = $entity->id;
|
||||
$attributeList = $this->fieldManagerUtil->getAttributeList($entity->getEntityType(), $field);
|
||||
$attributeList = $this->fieldUtil->getAttributeList($entity->getEntityType(), $field);
|
||||
foreach ($attributeList as $attribute) {
|
||||
if (in_array($attribute, $this->skipAttributeList)) continue;
|
||||
$itemData->$attribute = $entity->get($attribute);
|
||||
|
||||
@@ -33,7 +33,7 @@ use Espo\ORM\Entity;
|
||||
|
||||
use Espo\Core\Utils\{
|
||||
Config,
|
||||
FieldManagerUtil,
|
||||
FieldUtil,
|
||||
};
|
||||
|
||||
class CurrencyDefault
|
||||
@@ -41,17 +41,17 @@ class CurrencyDefault
|
||||
public static $order = 200;
|
||||
|
||||
protected $config;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
|
||||
public function __construct(Config $config, FieldManagerUtil $fieldManagerUtil)
|
||||
public function __construct(Config $config, FieldUtil $fieldUtil)
|
||||
{
|
||||
$this->config = $config;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
}
|
||||
|
||||
public function beforeSave(Entity $entity, array $options = [])
|
||||
{
|
||||
$fieldList = $this->fieldManagerUtil->getFieldByTypeList($entity->getEntityType(), 'currency');
|
||||
$fieldList = $this->fieldUtil->getFieldByTypeList($entity->getEntityType(), 'currency');
|
||||
|
||||
$defaultCurrency = $this->config->get('defaultCurrency');
|
||||
|
||||
|
||||
@@ -40,19 +40,14 @@ use Espo\Core\Di;
|
||||
|
||||
class Lead extends \Espo\Core\Templates\Services\Person implements
|
||||
|
||||
Di\FieldManagerUtilAware
|
||||
Di\FieldUtilAware
|
||||
{
|
||||
use Di\FieldManagerUtilSetter;
|
||||
use Di\FieldUtilSetter;
|
||||
|
||||
protected $linkMandatorySelectAttributeList = [
|
||||
'targetLists' => ['isOptedOut'],
|
||||
];
|
||||
|
||||
protected function getFieldManagerUtil()
|
||||
{
|
||||
return $this->fieldManagerUtil;
|
||||
}
|
||||
|
||||
protected function afterCreateEntity(Entity $entity, $data)
|
||||
{
|
||||
if (!empty($data->emailId)) {
|
||||
@@ -160,8 +155,8 @@ class Lead extends \Espo\Core\Templates\Services\Person implements
|
||||
continue;
|
||||
}
|
||||
|
||||
$leadAttributeList = $this->getFieldManagerUtil()->getAttributeList('Lead', $leadField);
|
||||
$attributeList = $this->getFieldManagerUtil()->getAttributeList($entityType, $field);
|
||||
$leadAttributeList = $this->fieldUtil->getAttributeList('Lead', $leadField);
|
||||
$attributeList = $this->fieldUtil->getAttributeList($entityType, $field);
|
||||
|
||||
foreach ($attributeList as $i => $attribute) {
|
||||
if (in_array($attribute, $ignoreAttributeList)) continue;
|
||||
|
||||
@@ -43,7 +43,7 @@ class DataPrivacy implements
|
||||
Di\MetadataAware,
|
||||
Di\ServiceFactoryAware,
|
||||
Di\EntityManagerAware,
|
||||
Di\FieldManagerUtilAware,
|
||||
Di\FieldUtilAware,
|
||||
Di\UserAware
|
||||
{
|
||||
use Di\AclSetter;
|
||||
@@ -51,7 +51,7 @@ class DataPrivacy implements
|
||||
use Di\MetadataSetter;
|
||||
use Di\ServiceFactorySetter;
|
||||
use Di\EntityManagerSetter;
|
||||
use Di\FieldManagerUtilSetter;
|
||||
use Di\FieldUtilSetter;
|
||||
use Di\UserSetter;
|
||||
|
||||
public function erase(string $entityType, string $id, array $fieldList)
|
||||
@@ -87,11 +87,11 @@ class DataPrivacy implements
|
||||
|
||||
$service->loadAdditionalFields($entity);
|
||||
|
||||
$filedManager = $this->fieldManagerUtil;
|
||||
$fieldUtil = $this->fieldUtil;
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
$type = $this->metadata->get(['entityDefs', $entityType, 'fields', $field, 'type']);
|
||||
$attributeList = $filedManager->getActualAttributeList($entityType, $field);
|
||||
$attributeList = $fieldUtil->getActualAttributeList($entityType, $field);
|
||||
|
||||
if ($type === 'email') {
|
||||
$emailAddressList = $entity->get('emailAddresses');
|
||||
|
||||
@@ -47,14 +47,14 @@ class EmailTemplate extends Record implements
|
||||
Di\LanguageAware,
|
||||
Di\NumberAware,
|
||||
Di\HtmlizerFactoryAware,
|
||||
Di\FieldManagerUtilAware
|
||||
Di\FieldUtilAware
|
||||
{
|
||||
use Di\FileStorageManagerSetter;
|
||||
use Di\DateTimeSetter;
|
||||
use Di\LanguageSetter;
|
||||
use Di\NumberSetter;
|
||||
use Di\HtmlizerFactorySetter;
|
||||
use Di\FieldManagerUtilSetter;
|
||||
use Di\FieldUtilSetter;
|
||||
|
||||
protected function getFileStorageManager()
|
||||
{
|
||||
@@ -409,7 +409,7 @@ class EmailTemplate extends Record implements
|
||||
}
|
||||
}
|
||||
|
||||
$fm = $this->fieldManagerUtil;
|
||||
$fm = $this->fieldUtil;
|
||||
|
||||
foreach ($dataList as $item) {
|
||||
$type = $item['type'];
|
||||
|
||||
@@ -44,13 +44,13 @@ class LeadCapture extends Record implements
|
||||
Di\EmailSenderAware,
|
||||
Di\DateTimeAware,
|
||||
Di\DefaultLanguageAware,
|
||||
Di\FieldManagerUtilAware,
|
||||
Di\FieldUtilAware,
|
||||
Di\HookManagerAware
|
||||
{
|
||||
use Di\EmailSenderSetter;
|
||||
use Di\DateTimeSetter;
|
||||
use Di\DefaultLanguageSetter;
|
||||
use Di\FieldManagerUtilSetter;
|
||||
use Di\FieldUtilSetter;
|
||||
use Di\HookManagerSetter;
|
||||
|
||||
protected $readOnlyAttributeList = ['apiKey'];
|
||||
@@ -64,7 +64,7 @@ class LeadCapture extends Record implements
|
||||
$requestUrl = $this->getConfig()->getSiteUrl() . '/api/v1/LeadCapture/' . $entity->get('apiKey');
|
||||
$entity->set('exampleRequestUrl', $requestUrl);
|
||||
|
||||
$fieldManagerUtil = $this->fieldManagerUtil;
|
||||
$fieldUtil = $this->fieldUtil;
|
||||
|
||||
$requestPayload = "```{\n";
|
||||
|
||||
@@ -75,7 +75,7 @@ class LeadCapture extends Record implements
|
||||
$fieldList = $entity->get('fieldList');
|
||||
if (is_array($fieldList)) {
|
||||
foreach ($fieldList as $field) {
|
||||
foreach ($fieldManagerUtil->getActualAttributeList('Lead', $field) as $attribute) {
|
||||
foreach ($fieldUtil->getActualAttributeList('Lead', $field) as $attribute) {
|
||||
if (!in_array($attribute, $attributeIgnoreList)) {
|
||||
$attributeList[] = $attribute;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ class LeadCapture extends Record implements
|
||||
}
|
||||
continue;
|
||||
}
|
||||
$attributeList = $this->fieldManagerUtil->getActualAttributeList('Lead', $field);
|
||||
$attributeList = $this->fieldUtil->getActualAttributeList('Lead', $field);
|
||||
if (empty($attributeList)) continue;
|
||||
foreach ($attributeList as $attribute) {
|
||||
if (property_exists($data, $attribute)) {
|
||||
|
||||
@@ -78,7 +78,7 @@ class Record implements Crud,
|
||||
Di\FileManagerAware,
|
||||
Di\SelectManagerFactoryAware,
|
||||
Di\InjectableFactoryAware,
|
||||
Di\FieldManagerUtilAware,
|
||||
Di\FieldUtilAware,
|
||||
Di\FieldValidatorManagerAware,
|
||||
Di\RecordServiceContainerAware,
|
||||
|
||||
@@ -95,7 +95,7 @@ class Record implements Crud,
|
||||
use Di\FileManagerSetter;
|
||||
use Di\SelectManagerFactorySetter;
|
||||
use Di\InjectableFactorySetter;
|
||||
use Di\FieldManagerUtilSetter;
|
||||
use Di\FieldUtilSetter;
|
||||
use Di\FieldValidatorManagerSetter;
|
||||
use Di\RecordServiceContainerSetter;
|
||||
|
||||
@@ -323,9 +323,12 @@ class Record implements Crud,
|
||||
return $this->metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
protected function getFieldManagerUtil()
|
||||
{
|
||||
return $this->fieldManagerUtil;
|
||||
return $this->fieldUtil;
|
||||
}
|
||||
|
||||
protected function getEntityManager()
|
||||
@@ -617,7 +620,7 @@ class Record implements Crud,
|
||||
|
||||
public function processValidation(Entity $entity, $data)
|
||||
{
|
||||
$fieldList = $this->getFieldManagerUtil()->getEntityTypeFieldList($this->entityType);
|
||||
$fieldList = $this->fieldUtil->getEntityTypeFieldList($this->entityType);
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (in_array($field, $this->validateSkipFieldList)) continue;
|
||||
@@ -630,13 +633,13 @@ class Record implements Crud,
|
||||
|
||||
protected function processValidationField(Entity $entity, $field, $data)
|
||||
{
|
||||
$fieldType = $this->getFieldManagerUtil()->getEntityTypeFieldParam($this->entityType, $field, 'type');
|
||||
$fieldType = $this->fieldUtil->getEntityTypeFieldParam($this->entityType, $field, 'type');
|
||||
$validationList = $this->getMetadata()->get(['fields', $fieldType, 'validationList'], []);
|
||||
$mandatoryValidationList = $this->getMetadata()->get(['fields', $fieldType, 'mandatoryValidationList'], []);
|
||||
$fieldValidatorManager = $this->fieldValidatorManager;
|
||||
|
||||
foreach ($validationList as $type) {
|
||||
$value = $this->getFieldManagerUtil()->getEntityTypeFieldParam($this->entityType, $field, $type);
|
||||
$value = $this->fieldUtil->getEntityTypeFieldParam($this->entityType, $field, $type);
|
||||
if (is_null($value)) {
|
||||
if (!in_array($type, $mandatoryValidationList)) {
|
||||
continue;
|
||||
@@ -658,7 +661,7 @@ class Record implements Crud,
|
||||
|
||||
protected function isFieldSetInData(StdClass $data, string $field) : bool
|
||||
{
|
||||
$attributeList = $this->getFieldManagerUtil()->getActualAttributeList($this->entityType, $field);
|
||||
$attributeList = $this->fieldUtil->getActualAttributeList($this->entityType, $field);
|
||||
$isSet = false;
|
||||
foreach ($attributeList as $attribute) {
|
||||
if (property_exists($data, $attribute)) {
|
||||
@@ -986,8 +989,8 @@ class Record implements Crud,
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->getFieldManagerUtil()->getEntityTypeFieldList($this->entityType) as $field) {
|
||||
$type = $this->getFieldManagerUtil()->getEntityTypeFieldParam($this->entityType, $field, 'type');
|
||||
foreach ($this->fieldUtil->getEntityTypeFieldList($this->entityType) as $field) {
|
||||
$type = $this->fieldUtil->getEntityTypeFieldParam($this->entityType, $field, 'type');
|
||||
if ($type === 'currency') {
|
||||
if ($entity->get($field) && !$entity->get($field . 'Currency')) {
|
||||
$entity->set($field . 'Currency', $this->getConfig()->get('defaultCurrency'));
|
||||
@@ -2518,7 +2521,7 @@ class Record implements Crud,
|
||||
|
||||
$fields = $this->getMetadata()->get(['entityDefs', $this->getEntityType(), 'fields'], []);
|
||||
|
||||
$fieldManager = $this->fieldManagerUtil;
|
||||
$fieldManager = $this->fieldUtil;
|
||||
|
||||
foreach ($fields as $field => $item) {
|
||||
if (!empty($item['duplicateIgnore']) || in_array($field, $this->duplicateIgnoreFieldList)) {
|
||||
@@ -2609,7 +2612,7 @@ class Record implements Crud,
|
||||
|
||||
protected function getFieldByTypeList($type)
|
||||
{
|
||||
return $this->getFieldManagerUtil()->getFieldByTypeList($this->entityType, $type);
|
||||
return $this->fieldUtil->getFieldByTypeList($this->entityType, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2746,7 +2749,7 @@ class Record implements Crud,
|
||||
$forbiddenFieldList = $this->getAcl()->getScopeForbiddenFieldList($this->entityType, 'edit');
|
||||
|
||||
$list = [];
|
||||
foreach ($this->getFieldManagerUtil()->getEntityTypeFieldList($this->entityType) as $field) {
|
||||
foreach ($this->fieldUtil->getEntityTypeFieldList($this->entityType) as $field) {
|
||||
if ($this->getMetadata()->get(['entityDefs', $this->entityType, 'fields', $field, 'type']) !== 'currency') continue;
|
||||
if (in_array($field, $forbiddenFieldList)) continue;
|
||||
$list[] = $field;
|
||||
|
||||
@@ -41,7 +41,7 @@ use Espo\Core\{
|
||||
InjectableFactory,
|
||||
ORM\EntityManager,
|
||||
Utils\Metadata,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
Utils\Config,
|
||||
DataManager,
|
||||
Utils\FieldValidatorManager,
|
||||
@@ -52,7 +52,7 @@ class Settings
|
||||
{
|
||||
protected $applicationState;
|
||||
protected $config;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
protected $metadata;
|
||||
protected $acl;
|
||||
protected $entityManager;
|
||||
@@ -65,7 +65,7 @@ class Settings
|
||||
Config $config,
|
||||
Metadata $metadata,
|
||||
Acl $acl,
|
||||
FieldManagerUtil $fieldManagerUtil,
|
||||
FieldUtil $fieldUtil,
|
||||
EntityManager $entityManager,
|
||||
DataManager $dataManager,
|
||||
FieldValidatorManager $fieldValidatorManager,
|
||||
@@ -75,7 +75,7 @@ class Settings
|
||||
$this->config = $config;
|
||||
$this->metadata = $metadata;
|
||||
$this->acl = $acl;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->dataManager = $dataManager;
|
||||
$this->fieldValidatorManager = $fieldValidatorManager;
|
||||
@@ -276,7 +276,7 @@ class Settings
|
||||
$fieldDefs = $this->metadata->get(['entityDefs', 'Settings', 'fields']);
|
||||
foreach ($fieldDefs as $field => $fieldParams) {
|
||||
if (!empty($fieldParams['onlyAdmin'])) {
|
||||
foreach ($this->fieldManagerUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
foreach ($this->fieldUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
$itemList[] = $attribute;
|
||||
}
|
||||
}
|
||||
@@ -292,7 +292,7 @@ class Settings
|
||||
$fieldDefs = $this->metadata->get(['entityDefs', 'Settings', 'fields']);
|
||||
foreach ($fieldDefs as $field => $fieldParams) {
|
||||
if (!empty($fieldParams['onlyUser'])) {
|
||||
foreach ($this->fieldManagerUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
foreach ($this->fieldUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
$itemList[] = $attribute;
|
||||
}
|
||||
}
|
||||
@@ -308,7 +308,7 @@ class Settings
|
||||
$fieldDefs = $this->metadata->get(['entityDefs', 'Settings', 'fields']);
|
||||
foreach ($fieldDefs as $field => $fieldParams) {
|
||||
if (!empty($fieldParams['onlySystem'])) {
|
||||
foreach ($this->fieldManagerUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
foreach ($this->fieldUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
$itemList[] = $attribute;
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ class Settings
|
||||
$fieldDefs = $this->metadata->get(['entityDefs', 'Settings', 'fields']);
|
||||
foreach ($fieldDefs as $field => $fieldParams) {
|
||||
if (!empty($fieldParams['global'])) {
|
||||
foreach ($this->fieldManagerUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
foreach ($this->fieldUtil->getAttributeList('Settings', $field) as $attribute) {
|
||||
$itemList[] = $attribute;
|
||||
}
|
||||
}
|
||||
@@ -335,7 +335,7 @@ class Settings
|
||||
|
||||
protected function processValidation(Entity $entity, $data)
|
||||
{
|
||||
$fieldList = $this->fieldManagerUtil->getEntityTypeFieldList('Settings');
|
||||
$fieldList = $this->fieldUtil->getEntityTypeFieldList('Settings');
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (!$this->isFieldSetInData($data, $field)) continue;
|
||||
@@ -345,13 +345,13 @@ class Settings
|
||||
|
||||
protected function processValidationField(Entity $entity, string $field, $data)
|
||||
{
|
||||
$fieldType = $this->fieldManagerUtil->getEntityTypeFieldParam('Settings', $field, 'type');
|
||||
$fieldType = $this->fieldUtil->getEntityTypeFieldParam('Settings', $field, 'type');
|
||||
$validationList = $this->metadata->get(['fields', $fieldType, 'validationList'], []);
|
||||
$mandatoryValidationList = $this->metadata->get(['fields', $fieldType, 'mandatoryValidationList'], []);
|
||||
$fieldValidatorManager = $this->fieldValidatorManager;
|
||||
|
||||
foreach ($validationList as $type) {
|
||||
$value = $this->fieldManagerUtil->getEntityTypeFieldParam('Settings', $field, $type);
|
||||
$value = $this->fieldUtil->getEntityTypeFieldParam('Settings', $field, $type);
|
||||
if (is_null($value) && !in_array($type, $mandatoryValidationList)) continue;
|
||||
|
||||
if (!$fieldValidatorManager->check($entity, $field, $type, $data)) {
|
||||
@@ -362,7 +362,7 @@ class Settings
|
||||
|
||||
protected function isFieldSetInData($data, $field)
|
||||
{
|
||||
$attributeList = $this->fieldManagerUtil->getActualAttributeList('Settings', $field);
|
||||
$attributeList = $this->fieldUtil->getActualAttributeList('Settings', $field);
|
||||
$isSet = false;
|
||||
foreach ($attributeList as $attribute) {
|
||||
if (property_exists($data, $attribute)) {
|
||||
|
||||
@@ -50,7 +50,7 @@ use Espo\Core\{
|
||||
ServiceFactory,
|
||||
Portal\AclManagerContainer as PortalAclManagerContainer,
|
||||
Select\SelectManagerFactory,
|
||||
Utils\FieldManagerUtil,
|
||||
Utils\FieldUtil,
|
||||
Record\Collection as RecordCollection,
|
||||
};
|
||||
|
||||
@@ -73,7 +73,7 @@ class Stream
|
||||
protected $serviceFactory;
|
||||
protected $portalAclManagerContainer;
|
||||
protected $selectManagerFactory;
|
||||
protected $fieldManagerUtil;
|
||||
protected $fieldUtil;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
@@ -85,7 +85,7 @@ class Stream
|
||||
ServiceFactory $serviceFactory,
|
||||
PortalAclManagerContainer $portalAclManagerContainer,
|
||||
SelectManagerFactory $selectManagerFactory,
|
||||
FieldManagerUtil $fieldManagerUtil
|
||||
FieldUtil $fieldUtil
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
@@ -96,7 +96,7 @@ class Stream
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
$this->portalAclManagerContainer = $portalAclManagerContainer;
|
||||
$this->selectManagerFactory = $selectManagerFactory;
|
||||
$this->fieldManagerUtil = $fieldManagerUtil;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
}
|
||||
|
||||
protected $auditedFieldsCache = [];
|
||||
@@ -1505,8 +1505,8 @@ class Stream
|
||||
continue;
|
||||
}
|
||||
$auditedFields[$field] = array();
|
||||
$auditedFields[$field]['actualList'] = $this->fieldManagerUtil->getActualAttributeList($entityType, $field);
|
||||
$auditedFields[$field]['notActualList'] = $this->fieldManagerUtil->getNotActualAttributeList($entityType, $field);
|
||||
$auditedFields[$field]['actualList'] = $this->fieldUtil->getActualAttributeList($entityType, $field);
|
||||
$auditedFields[$field]['notActualList'] = $this->fieldUtil->getNotActualAttributeList($entityType, $field);
|
||||
$auditedFields[$field]['fieldType'] = $d['type'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +96,9 @@ class FieldManager
|
||||
return $this->container->get('defaultLanguage');
|
||||
}
|
||||
|
||||
protected function getFieldManagerUtil()
|
||||
protected function getFieldUtil()
|
||||
{
|
||||
return $this->container->get('fieldManagerUtil');
|
||||
return $this->container->get('fieldUtil');
|
||||
}
|
||||
|
||||
public function read(string $scope, string $name) : array
|
||||
|
||||
Reference in New Issue
Block a user