const usage
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Classes\Acl\Email;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Email;
|
||||
use Espo\ORM\Entity;
|
||||
@@ -100,12 +101,11 @@ class AccessChecker implements AccessEntityCREDSChecker
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @var string[] $assignedUserIdList */
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList('assignedUsers');
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList(Field::ASSIGNED_USERS);
|
||||
|
||||
if (
|
||||
count($assignedUserIdList) === 1 &&
|
||||
$entity->hasLinkMultipleId('assignedUsers', $user->getId())
|
||||
$entity->hasLinkMultipleId(Field::ASSIGNED_USERS, $user->getId())
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
$createdAt = $entity->get('createdAt');
|
||||
$createdAt = $entity->get(Field::CREATED_AT);
|
||||
|
||||
if (!$createdAt) {
|
||||
return true;
|
||||
@@ -209,7 +209,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
$createdAt = $entity->get('createdAt');
|
||||
$createdAt = $entity->get(Field::CREATED_AT);
|
||||
|
||||
if (!$createdAt) {
|
||||
return true;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Classes\AclPortal\Note;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\User;
|
||||
use Espo\ORM\Entity;
|
||||
@@ -137,7 +138,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
$createdAt = $entity->get('createdAt');
|
||||
$createdAt = $entity->get(Field::CREATED_AT);
|
||||
|
||||
if (!$createdAt) {
|
||||
return true;
|
||||
@@ -174,7 +175,7 @@ class AccessChecker implements AccessEntityCREDChecker
|
||||
return false;
|
||||
}
|
||||
|
||||
$createdAt = $entity->get('createdAt');
|
||||
$createdAt = $entity->get(Field::CREATED_AT);
|
||||
|
||||
if (!$createdAt) {
|
||||
return true;
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Classes\Cleanup;
|
||||
|
||||
use Espo\Core\Cleanup\Cleanup;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Entities\StreamSubscription;
|
||||
@@ -77,7 +78,7 @@ class Subscribers implements Cleanup
|
||||
}
|
||||
|
||||
/** @var string $dateField */
|
||||
$dateField = $data['dateField'] ?? 'createdAt';
|
||||
$dateField = $data['dateField'] ?? Field::CREATED_AT;
|
||||
/** @var ?string[] $statusList */
|
||||
$statusList = $data['statusList'] ?? null;
|
||||
/** @var ?string $statusField */
|
||||
|
||||
@@ -36,6 +36,7 @@ use Espo\Core\Console\Exceptions\InvalidArgument;
|
||||
use Espo\Core\Console\IO;
|
||||
use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\FieldProcessing\NextNumber\BeforeSaveProcessor;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
use Espo\ORM\EntityManager;
|
||||
@@ -62,7 +63,7 @@ class PopulateNumbers implements Command
|
||||
$entityType = $params->getArgument(0);
|
||||
$field = $params->getArgument(1);
|
||||
|
||||
$orderBy = $params->getOption('orderBy') ?? 'createdAt';
|
||||
$orderBy = $params->getOption('orderBy') ?? Field::CREATED_AT;
|
||||
$order = strtoupper($params->getOption('order') ?? Order::ASC);
|
||||
|
||||
if (!$entityType) {
|
||||
|
||||
@@ -52,8 +52,8 @@ class DefaultSidePanelType
|
||||
$this->metadata->get(['entityDefs', $scope, 'fields', 'assignedUser', 'type']) === FieldType::LINK &&
|
||||
$this->metadata->get(['entityDefs', $scope, 'links', 'assignedUser', 'entity']) === User::ENTITY_TYPE
|
||||
||
|
||||
$this->metadata->get(['entityDefs', $scope, 'fields', 'assignedUsers', 'type']) === FieldType::LINK_MULTIPLE &&
|
||||
$this->metadata->get(['entityDefs', $scope, 'links', 'assignedUsers', 'entity']) === User::ENTITY_TYPE
|
||||
$this->metadata->get(['entityDefs', $scope, 'fields', Field::ASSIGNED_USERS, 'type']) === FieldType::LINK_MULTIPLE &&
|
||||
$this->metadata->get(['entityDefs', $scope, 'links', Field::ASSIGNED_USERS, 'entity']) === User::ENTITY_TYPE
|
||||
) {
|
||||
$list[] = (object) ['name' => ':assignedUser'];
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Classes\FieldProcessing\User;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\AuthLogRecord;
|
||||
use Espo\Entities\AuthToken;
|
||||
use Espo\Entities\User;
|
||||
@@ -96,13 +97,13 @@ class LastAccessLoader implements Loader
|
||||
|
||||
$authLogRecord = $this->entityManager
|
||||
->getRDBRepository(AuthLogRecord::ENTITY_TYPE)
|
||||
->select(['id', 'createdAt'])
|
||||
->select(['id', Field::CREATED_AT])
|
||||
->where($where)
|
||||
->order('requestTime', true)
|
||||
->findOne();
|
||||
|
||||
if ($authLogRecord) {
|
||||
$lastAccess = $authLogRecord->get('createdAt');
|
||||
$lastAccess = $authLogRecord->get(Field::CREATED_AT);
|
||||
}
|
||||
|
||||
$entity->set('lastAccess', $lastAccess);
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Espo\Classes\Jobs;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Job\Job\Status as JobStatus;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Type\FieldType;
|
||||
use Espo\Core\Record\ServiceContainer;
|
||||
use Espo\Core\Utils\DateTime as DateTimeUtil;
|
||||
@@ -186,7 +187,7 @@ class Cleanup implements JobDataLess
|
||||
->where([
|
||||
'scheduledJobId' => $scheduledJobId,
|
||||
])
|
||||
->order('createdAt', 'DESC')
|
||||
->order(Field::CREATED_AT, 'DESC')
|
||||
->limit(0, 10)
|
||||
->find();
|
||||
|
||||
@@ -355,7 +356,7 @@ class Cleanup implements JobDataLess
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!$this->metadata->get(['entityDefs', $scope, 'fields', 'modifiedAt'])) {
|
||||
if (!$this->metadata->get(['entityDefs', $scope, 'fields', Field::MODIFIED_AT])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -767,9 +768,9 @@ class Cleanup implements JobDataLess
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->metadata->get(['entityDefs', $scope, 'fields', 'modifiedAt'])) {
|
||||
if ($this->metadata->get(['entityDefs', $scope, 'fields', Field::MODIFIED_AT])) {
|
||||
$whereClause['modifiedAt<'] = $datetime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT);
|
||||
} else if ($this->metadata->get(['entityDefs', $scope, 'fields', 'createdAt'])) {
|
||||
} else if ($this->metadata->get(['entityDefs', $scope, 'fields', Field::CREATED_AT])) {
|
||||
$whereClause['createdAt<'] = $datetime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Job\JobDataLess;
|
||||
use Espo\Core\Mail\Exceptions\NoSmtp;
|
||||
use Espo\Core\Mail\Exceptions\SendingError;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Language;
|
||||
use Espo\Core\Utils\Log;
|
||||
@@ -74,7 +75,7 @@ class SendScheduledEmails implements JobDataLess
|
||||
'sendAt<' => DateTime::createNow()->toString(),
|
||||
])
|
||||
->order('sendAt')
|
||||
->order('createdAt')
|
||||
->order(Field::CREATED_AT)
|
||||
->limit(0, $this->getPortion())
|
||||
->sth()
|
||||
->find();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Controllers;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Tools\Notification\RecordService as Service;
|
||||
|
||||
use Espo\Core\Api\Request;
|
||||
@@ -70,7 +71,7 @@ class Notification extends RecordBase
|
||||
->withWhereAdded(
|
||||
WhereItem
|
||||
::createBuilder()
|
||||
->setAttribute('createdAt')
|
||||
->setAttribute(Field::CREATED_AT)
|
||||
->setType(WhereItem\Type::AFTER)
|
||||
->setValue($after)
|
||||
->build()
|
||||
|
||||
@@ -35,6 +35,7 @@ use Espo\Core\Api\Request;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Record\SearchParamsFetcher;
|
||||
|
||||
use Espo\Core\Select\SearchParams;
|
||||
@@ -171,7 +172,7 @@ class Stream
|
||||
->withWhereAdded(
|
||||
WhereItem
|
||||
::createBuilder()
|
||||
->setAttribute('createdAt')
|
||||
->setAttribute(Field::CREATED_AT)
|
||||
->setType(WhereItem\Type::AFTER)
|
||||
->setValue($after)
|
||||
->build()
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Core\Authentication\AuthToken;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\ORM\EntityManager;
|
||||
use Espo\ORM\Repository\RDBRepository;
|
||||
use Espo\Entities\AuthToken as AuthTokenEntity;
|
||||
@@ -67,9 +68,9 @@ class EspoManager implements Manager
|
||||
'userId',
|
||||
'portalId',
|
||||
'hash',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
'lastAccess',
|
||||
'modifiedAt',
|
||||
Field::MODIFIED_AT,
|
||||
])
|
||||
->where(['token' => $token])
|
||||
->findOne();
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Core\Authentication\TwoFactor\Email;
|
||||
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Mail\Exceptions\SendingError;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Mail\EmailSender;
|
||||
use Espo\Core\Mail\EmailFactory;
|
||||
@@ -244,7 +245,7 @@ class Util
|
||||
Cond::and(
|
||||
Cond::equal(Cond::column('method'), 'Email'),
|
||||
Cond::equal(Cond::column('userId'), $user->getId()),
|
||||
Cond::greaterOrEqual(Cond::column('createdAt'), $from),
|
||||
Cond::greaterOrEqual(Cond::column(Field::CREATED_AT), $from),
|
||||
Cond::lessOrEqual(Cond::column('attemptsLeft'), 0),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Core\Authentication\TwoFactor\Sms;
|
||||
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Sms\SmsSender;
|
||||
use Espo\Core\Sms\SmsFactory;
|
||||
@@ -238,7 +239,7 @@ class Util
|
||||
Cond::and(
|
||||
Cond::equal(Cond::column('method'), self::METHOD),
|
||||
Cond::equal(Cond::column('userId'), $user->getId()),
|
||||
Cond::greaterOrEqual(Cond::column('createdAt'), $from),
|
||||
Cond::greaterOrEqual(Cond::column(Field::CREATED_AT), $from),
|
||||
Cond::lessOrEqual(Cond::column('attemptsLeft'), 0),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Core\FieldProcessing\Reminder;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Id\RecordIdGenerator;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
use Espo\Entities\Preferences;
|
||||
@@ -177,7 +178,10 @@ class Saver implements SaverInterface
|
||||
return $entity->isNew() ||
|
||||
$this->toReCreate($entity) ||
|
||||
$entity->isAttributeChanged('assignedUserId') ||
|
||||
($entity->hasLinkMultipleField('assignedUsers') && $entity->isAttributeChanged('assignedUsersIds')) ||
|
||||
(
|
||||
$entity->hasLinkMultipleField(Field::ASSIGNED_USERS) &&
|
||||
$entity->isAttributeChanged(Field::ASSIGNED_USERS . 'Ids')
|
||||
) ||
|
||||
($entity->hasLinkMultipleField('users') && $entity->isAttributeChanged('usersIds')) ||
|
||||
$entity->isAttributeChanged($dateAttribute);
|
||||
}
|
||||
@@ -248,8 +252,8 @@ class Saver implements SaverInterface
|
||||
return $entity->getLinkMultipleIdList('users');
|
||||
}
|
||||
|
||||
if ($entity->hasLinkMultipleField('assignedUsers')) {
|
||||
return $entity->getLinkMultipleIdList('assignedUsers');
|
||||
if ($entity->hasLinkMultipleField(Field::ASSIGNED_USERS)) {
|
||||
return $entity->getLinkMultipleIdList(Field::ASSIGNED_USERS);
|
||||
}
|
||||
|
||||
$userIdList = [];
|
||||
|
||||
@@ -407,8 +407,8 @@ class AfterFetch implements AfterFetchInterface
|
||||
{
|
||||
$userIdList = [];
|
||||
|
||||
if ($case->hasLinkMultipleField('assignedUsers')) {
|
||||
$userIdList = $case->getLinkMultipleIdList('assignedUsers');
|
||||
if ($case->hasLinkMultipleField(Field::ASSIGNED_USERS)) {
|
||||
$userIdList = $case->getLinkMultipleIdList(Field::ASSIGNED_USERS);
|
||||
} else {
|
||||
$assignedUserLink = $case->getAssignedUser();
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ class DefaultImporter implements Importer
|
||||
]);
|
||||
|
||||
$this->linkMultipleSaver->process($email, 'users', $saverParams);
|
||||
$this->linkMultipleSaver->process($email, 'assignedUsers', $saverParams);
|
||||
$this->linkMultipleSaver->process($email, Field::ASSIGNED_USERS, $saverParams);
|
||||
$this->linkMultipleSaver->process($email, Field::TEAMS, $saverParams);
|
||||
|
||||
if ($this->notificationsEnabled()) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Core\Notification;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\ORM\EntityManager;
|
||||
@@ -43,7 +44,7 @@ class DefaultAssignmentNotificator implements AssignmentNotificator
|
||||
{
|
||||
public const OPTION_FORCE_ASSIGNED_USER = 'forceAssignedUser';
|
||||
|
||||
private const FIELD_ASSIGNED_USERS = 'assignedUsers';
|
||||
private const FIELD_ASSIGNED_USERS = Field::ASSIGNED_USERS;
|
||||
private const ATTR_ASSIGNED_USER_ID = 'assignedUserId';
|
||||
|
||||
public function __construct(
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Core\Select\Bool\Filters;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Select\Bool\Filter;
|
||||
use Espo\Core\Select\Helpers\FieldHelper;
|
||||
use Espo\Entities\User;
|
||||
@@ -67,7 +68,7 @@ class OnlyMy implements Filter
|
||||
if ($this->fieldHelper->hasAssignedUsersField()) {
|
||||
$relationDefs = $this->defs
|
||||
->getEntity($this->entityType)
|
||||
->getRelation('assignedUsers');
|
||||
->getRelation(Field::ASSIGNED_USERS);
|
||||
|
||||
$middleEntityType = ucfirst($relationDefs->getRelationshipName());
|
||||
$key1 = $relationDefs->getMidKey();
|
||||
|
||||
@@ -51,7 +51,7 @@ class RelationQueryHelper
|
||||
return $this->prepareRelatedUsersWhere(
|
||||
$entityType,
|
||||
$userId,
|
||||
'assignedUsers',
|
||||
Field::ASSIGNED_USERS,
|
||||
User::RELATIONSHIP_ENTITY_USER
|
||||
);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Core\Utils\Database\Orm\FieldConverters;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Defs\AttributeParam;
|
||||
use Espo\Core\Utils\Database\Orm\Defs\AttributeDefs;
|
||||
use Espo\Core\Utils\Database\Orm\Defs\EntityDefs;
|
||||
@@ -50,7 +51,7 @@ class AttachmentMultiple implements FieldConverter
|
||||
->withNotStorable()
|
||||
->withParamsMerged([
|
||||
'orderBy' => [
|
||||
['createdAt', Order::ASC],
|
||||
[Field::CREATED_AT, Order::ASC],
|
||||
['name', Order::ASC],
|
||||
],
|
||||
AttributeParam::IS_LINK_MULTIPLE_ID_LIST => true,
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
namespace Espo\Core\Webhook;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DataCache;
|
||||
use Espo\Core\Utils\FieldUtil;
|
||||
use Espo\Core\Utils\Log;
|
||||
|
||||
use Espo\Entities\Webhook;
|
||||
use Espo\Entities\WebhookEventQueueItem;
|
||||
|
||||
@@ -51,8 +51,8 @@ class Manager
|
||||
/** @var string[] */
|
||||
protected $skipAttributeList = [
|
||||
'isFollowed',
|
||||
'modifiedAt',
|
||||
'modifiedBy'
|
||||
Field::MODIFIED_AT,
|
||||
Field::MODIFIED_BY,
|
||||
];
|
||||
|
||||
/** @var ?array<string, bool> */
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Core\Webhook;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Entities\Webhook;
|
||||
use Espo\Entities\WebhookEventQueueItem;
|
||||
@@ -99,7 +100,7 @@ class Queue
|
||||
'event' => $item->get('event'),
|
||||
'isActive' => true,
|
||||
])
|
||||
->order('createdAt')
|
||||
->order(Field::CREATED_AT)
|
||||
->find();
|
||||
|
||||
foreach ($webhookList as $webhook) {
|
||||
|
||||
@@ -697,7 +697,7 @@ class Email extends Entity
|
||||
public function getAssignedUsers(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject('assignedUsers');
|
||||
return $this->getValueObject(Field::ASSIGNED_USERS);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
@@ -823,7 +823,7 @@ class Email extends Entity
|
||||
|
||||
public function addAssignedUserId(string $assignedUserId): self
|
||||
{
|
||||
$this->addLinkMultipleId('assignedUsers', $assignedUserId);
|
||||
$this->addLinkMultipleId(Field::ASSIGNED_USERS, $assignedUserId);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Entities;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Link;
|
||||
@@ -87,7 +88,7 @@ class Export extends Entity
|
||||
|
||||
public function getCreatedAt(): DateTime
|
||||
{
|
||||
$value = $this->getValueObject('createdAt');
|
||||
$value = $this->getValueObject(Field::CREATED_AT);
|
||||
|
||||
if (!$value instanceof DateTime) {
|
||||
throw new RuntimeException("No 'createdAt'.");
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Entities;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Link;
|
||||
@@ -117,7 +118,7 @@ class MassAction extends Entity
|
||||
|
||||
public function getCreatedAt(): DateTime
|
||||
{
|
||||
$value = $this->getValueObject('createdAt');
|
||||
$value = $this->getValueObject(Field::CREATED_AT);
|
||||
|
||||
if (!$value instanceof DateTime) {
|
||||
throw new RuntimeException("No 'createdAt'.");
|
||||
@@ -128,7 +129,7 @@ class MassAction extends Entity
|
||||
|
||||
public function getCreatedBy(): Link
|
||||
{
|
||||
$value = $this->getValueObject('createdBy');
|
||||
$value = $this->getValueObject(Field::CREATED_BY);
|
||||
|
||||
if (!$value instanceof Link) {
|
||||
throw new RuntimeException("No 'createdBy'.");
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Entities;
|
||||
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
@@ -135,7 +136,7 @@ class Note extends Entity
|
||||
public function getCreatedAt(): ?DateTime
|
||||
{
|
||||
/** @var ?DateTime */
|
||||
return $this->getValueObject('createdAt');
|
||||
return $this->getValueObject(Field::CREATED_AT);
|
||||
}
|
||||
|
||||
public function setAclIsProcessed(): void
|
||||
@@ -167,7 +168,7 @@ class Note extends Entity
|
||||
$collection = $this->entityManager
|
||||
->getRDBRepository(Attachment::ENTITY_TYPE)
|
||||
->select(['id', 'name', 'type'])
|
||||
->order('createdAt')
|
||||
->order(Field::CREATED_AT)
|
||||
->where([
|
||||
'id' => $attachmentsIds
|
||||
])
|
||||
|
||||
@@ -58,7 +58,7 @@ class Sms extends Entity implements SmsInterface
|
||||
public function getCreatedAt(): ?DateTime
|
||||
{
|
||||
/** @var ?DateTime */
|
||||
return $this->getValueObject('createdAt');
|
||||
return $this->getValueObject(Field::CREATED_AT);
|
||||
}
|
||||
|
||||
public function getBody(): string
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Entities;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Name\Field;
|
||||
|
||||
class TwoFactorCode extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
@@ -43,7 +44,7 @@ class TwoFactorCode extends \Espo\Core\ORM\Entity
|
||||
public function getCreatedAt(): DateTime
|
||||
{
|
||||
/** @var DateTime */
|
||||
return $this->getValueObject('createdAt');
|
||||
return $this->getValueObject(Field::CREATED_AT);
|
||||
}
|
||||
|
||||
public function getCode(): string
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Entities;
|
||||
|
||||
use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
|
||||
use stdClass;
|
||||
@@ -59,7 +60,7 @@ class UniqueId extends Entity
|
||||
public function getCreatedAt(): DateTime
|
||||
{
|
||||
/** @var ?DateTime $value */
|
||||
$value = $this->getValueObject('createdAt');
|
||||
$value = $this->getValueObject(Field::CREATED_AT);
|
||||
|
||||
if (!$value) {
|
||||
throw new LogicException();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Modules\Crm\Business\Distribution\Lead;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Modules\Crm\Entities\Lead;
|
||||
use Espo\ORM\EntityManager;
|
||||
|
||||
@@ -87,7 +88,7 @@ class RoundRobin
|
||||
->where([
|
||||
'assignedUserId' => $userIdList
|
||||
])
|
||||
->order('createdAt', 'DESC')
|
||||
->order(Field::CREATED_AT, 'DESC')
|
||||
->findOne();
|
||||
|
||||
if (empty($lead)) {
|
||||
|
||||
@@ -33,6 +33,7 @@ use Espo\Core\Field\DateTime;
|
||||
use Espo\Core\Field\Link;
|
||||
use Espo\Core\Field\LinkMultiple;
|
||||
use Espo\Core\Field\LinkParent;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Entities\User;
|
||||
|
||||
@@ -90,25 +91,25 @@ class Call extends Entity
|
||||
public function getCreatedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject('createdBy');
|
||||
return $this->getValueObject(Field::CREATED_BY);
|
||||
}
|
||||
|
||||
public function getModifiedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject('modifiedBy');
|
||||
return $this->getValueObject(Field::MODIFIED_BY);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject('assignedUser');
|
||||
return $this->getValueObject(Field::ASSIGNED_USER);
|
||||
}
|
||||
|
||||
public function getTeams(): LinkMultiple
|
||||
{
|
||||
/** @var LinkMultiple */
|
||||
return $this->getValueObject('teams');
|
||||
return $this->getValueObject(Field::TEAMS);
|
||||
}
|
||||
|
||||
public function getUsers(): LinkMultiple
|
||||
|
||||
@@ -96,13 +96,13 @@ class Meeting extends Entity
|
||||
public function getCreatedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject('createdBy');
|
||||
return $this->getValueObject(Field::CREATED_BY);
|
||||
}
|
||||
|
||||
public function getModifiedBy(): ?Link
|
||||
{
|
||||
/** @var ?Link */
|
||||
return $this->getValueObject('modifiedBy');
|
||||
return $this->getValueObject(Field::MODIFIED_BY);
|
||||
}
|
||||
|
||||
public function getAssignedUser(): ?Link
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Modules\Crm\Hooks\Meeting;
|
||||
|
||||
use Espo\Core\Hook\Hook\BeforeSave;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Entities\User;
|
||||
@@ -55,15 +56,15 @@ class Users implements BeforeSave
|
||||
public function beforeSave(Entity $entity, SaveOptions $options): void
|
||||
{
|
||||
if (!$this->config->get('eventAssignedUserIsAttendeeDisabled')) {
|
||||
if ($entity->hasLinkMultipleField('assignedUsers')) {
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList('assignedUsers');
|
||||
if ($entity->hasLinkMultipleField(Field::ASSIGNED_USERS)) {
|
||||
$assignedUserIdList = $entity->getLinkMultipleIdList(Field::ASSIGNED_USERS);
|
||||
|
||||
foreach ($assignedUserIdList as $assignedUserId) {
|
||||
$entity->addLinkMultipleId('users', $assignedUserId);
|
||||
$entity->setLinkMultipleName(
|
||||
'users',
|
||||
$assignedUserId,
|
||||
$entity->getLinkMultipleName('assignedUsers', $assignedUserId)
|
||||
$entity->getLinkMultipleName(Field::ASSIGNED_USERS, $assignedUserId)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -35,6 +35,7 @@ use Espo\Core\Exceptions\Error;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ServiceFactory;
|
||||
use Espo\Core\Templates\Entities\Company;
|
||||
use Espo\Core\Templates\Entities\Person;
|
||||
@@ -129,7 +130,7 @@ class Service
|
||||
'parentType',
|
||||
'parentId',
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
['null', 'hasAttachment'],
|
||||
])
|
||||
->leftJoin(
|
||||
@@ -201,7 +202,7 @@ class Service
|
||||
'parentType',
|
||||
'parentId',
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
['null', 'hasAttachment'],
|
||||
])
|
||||
->leftJoin(
|
||||
@@ -274,7 +275,7 @@ class Service
|
||||
'parentType',
|
||||
'parentId',
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
'hasAttachment',
|
||||
])
|
||||
->leftJoin(
|
||||
@@ -347,7 +348,7 @@ class Service
|
||||
'parentType',
|
||||
'parentId',
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
['false', 'hasAttachment'],
|
||||
]);
|
||||
} catch (BadRequest|Forbidden $e) {
|
||||
@@ -475,7 +476,7 @@ class Service
|
||||
'parentType',
|
||||
'parentId',
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
'hasAttachment',
|
||||
]);
|
||||
} catch (BadRequest|Forbidden $e) {
|
||||
@@ -689,7 +690,7 @@ class Service
|
||||
if ($scope === User::ENTITY_TYPE) {
|
||||
$maxSizeQ++;
|
||||
} else {
|
||||
$builder->order('createdAt', 'DESC');
|
||||
$builder->order(Field::CREATED_AT, 'DESC');
|
||||
}
|
||||
|
||||
if ($maxSize) {
|
||||
@@ -1072,7 +1073,7 @@ class Service
|
||||
($seed->hasAttribute('parentType') ? ['parentType', 'parentType'] : ['null', 'parentType']),
|
||||
($seed->hasAttribute('parentId') ? ['parentId', 'parentId'] : ['null', 'parentId']),
|
||||
'status',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
['false', 'hasAttachment'],
|
||||
]);
|
||||
} catch (BadRequest|Forbidden $e) {
|
||||
|
||||
@@ -255,7 +255,7 @@ class Service
|
||||
($seed->hasAttribute('dateEndDate') ? ['dateEndDate', 'dateEndDate'] : ['null', 'dateEndDate']),
|
||||
($seed->hasAttribute('parentType') ? ['parentType', 'parentType'] : ['null', 'parentType']),
|
||||
($seed->hasAttribute('parentId') ? ['parentId', 'parentId'] : ['null', 'parentId']),
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
];
|
||||
|
||||
$additionalAttributeList = $this->metadata->get(
|
||||
@@ -276,7 +276,7 @@ class Service
|
||||
$orGroup['usersMiddle.userId'] = $userId;
|
||||
}
|
||||
|
||||
if ($seed->hasRelation('assignedUsers')) {
|
||||
if ($seed->hasRelation(Field::ASSIGNED_USERS)) {
|
||||
$orGroup['assignedUsersMiddle.userId'] = $userId;
|
||||
}
|
||||
|
||||
@@ -323,10 +323,10 @@ class Service
|
||||
->leftJoin('users');
|
||||
}
|
||||
|
||||
if ($seed->hasRelation('assignedUsers')) {
|
||||
if ($seed->hasRelation(Field::ASSIGNED_USERS)) {
|
||||
$queryBuilder
|
||||
->distinct()
|
||||
->leftJoin('assignedUsers');
|
||||
->leftJoin(Field::ASSIGNED_USERS);
|
||||
}
|
||||
|
||||
return $queryBuilder->build();
|
||||
@@ -353,7 +353,7 @@ class Service
|
||||
['dateEndDate', 'dateEndDate'],
|
||||
'parentType',
|
||||
'parentId',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
];
|
||||
|
||||
$seed = $this->entityManager->getNewEntity(Meeting::ENTITY_TYPE);
|
||||
@@ -418,7 +418,7 @@ class Service
|
||||
['null', 'dateEndDate'],
|
||||
'parentType',
|
||||
'parentId',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
];
|
||||
|
||||
$seed = $this->entityManager->getNewEntity(Call::ENTITY_TYPE);
|
||||
@@ -483,7 +483,7 @@ class Service
|
||||
['dateEndDate', 'dateEndDate'],
|
||||
'parentType',
|
||||
'parentId',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
];
|
||||
|
||||
$seed = $this->entityManager->getNewEntity(Task::ENTITY_TYPE);
|
||||
@@ -525,9 +525,9 @@ class Service
|
||||
}
|
||||
|
||||
if (
|
||||
$this->metadata->get(['entityDefs', 'Task', 'fields', 'assignedUsers', 'type']) ===
|
||||
$this->metadata->get(['entityDefs', 'Task', 'fields', Field::ASSIGNED_USERS, 'type']) ===
|
||||
FieldType::LINK_MULTIPLE &&
|
||||
!$this->metadata->get(['entityDefs', 'Task', 'fields', 'assignedUsers', 'disabled'])
|
||||
!$this->metadata->get(['entityDefs', 'Task', 'fields', Field::ASSIGNED_USERS, 'disabled'])
|
||||
) {
|
||||
$queryBuilder->where(
|
||||
$this->relationQueryHelper->prepareAssignedUsersWhere(Task::ENTITY_TYPE, $userId)
|
||||
|
||||
@@ -35,6 +35,7 @@ use Espo\Core\Exceptions\Conflict;
|
||||
use Espo\Core\Exceptions\ConflictSilent;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Type\FieldType;
|
||||
use Espo\Core\Record\CreateParams;
|
||||
use Espo\Core\Record\ServiceContainer;
|
||||
@@ -148,12 +149,12 @@ class ConvertService
|
||||
$entityList = $this->metadata->get('entityDefs.Lead.convertEntityList', []);
|
||||
|
||||
$ignoreAttributeList = [
|
||||
'createdAt',
|
||||
'modifiedAt',
|
||||
'modifiedById',
|
||||
'modifiedByName',
|
||||
'createdById',
|
||||
'createdByName',
|
||||
Field::CREATED_AT,
|
||||
Field::MODIFIED_AT,
|
||||
Field::MODIFIED_BY . 'Id',
|
||||
Field::MODIFIED_BY . 'Name',
|
||||
Field::CREATED_BY . 'Id',
|
||||
Field::MODIFIED_BY . 'Name',
|
||||
];
|
||||
|
||||
/** @var array<string, array<string, string>> $convertFieldsDefs */
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Modules\Crm\Tools\MassEmail;
|
||||
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\HookManager;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\EntityManager;
|
||||
use Espo\Core\Utils\Hasher;
|
||||
use Espo\Entities\EmailAddress;
|
||||
@@ -174,7 +175,7 @@ class UnsubscribeService
|
||||
'queueItemId' => $queueItemId,
|
||||
'action' => CampaignLogRecord::ACTION_OPTED_OUT,
|
||||
])
|
||||
->order('createdAt', true)
|
||||
->order(Field::CREATED_AT, true)
|
||||
->findOne();
|
||||
|
||||
if ($logRecord) {
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Espo\Modules\Crm\Tools\TargetList;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Exceptions\NotFound;
|
||||
use Espo\Core\HookManager;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Record\Collection;
|
||||
use Espo\Core\Record\Collection as RecordCollection;
|
||||
use Espo\Core\Record\EntityProvider;
|
||||
@@ -176,7 +177,7 @@ class OptOutService
|
||||
|
||||
$unionQuery = $builder
|
||||
->limit($offset, $maxSize)
|
||||
->order('createdAt', 'DESC')
|
||||
->order(Field::CREATED_AT, 'DESC')
|
||||
->build();
|
||||
|
||||
$sth = $em->getQueryExecutor()->execute($unionQuery);
|
||||
@@ -228,7 +229,7 @@ class OptOutService
|
||||
->select([
|
||||
'id',
|
||||
'name',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
["'$entityType'", 'entityType'],
|
||||
])
|
||||
->join(
|
||||
@@ -241,7 +242,7 @@ class OptOutService
|
||||
'j.targetListId' => $id,
|
||||
]
|
||||
)
|
||||
->order('createdAt', Order::DESC)
|
||||
->order(Field::CREATED_AT, Order::DESC)
|
||||
->build();
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\ActionHistory;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Record\ActionHistory\Action;
|
||||
use Espo\Core\Record\Collection as RecordCollection;
|
||||
use Espo\Entities\ActionHistoryRecord;
|
||||
@@ -71,12 +72,12 @@ class Service
|
||||
'action' => Action::READ,
|
||||
'targetType' => $targetTypeList,
|
||||
])
|
||||
->order('MAX:createdAt', 'DESC')
|
||||
->order('MAX:' . Field::CREATED_AT, 'DESC')
|
||||
->select([
|
||||
'targetId',
|
||||
'targetType',
|
||||
'MAX:number',
|
||||
['MAX:createdAt', 'createdAt'],
|
||||
['MAX:createdAt', Field::CREATED_AT],
|
||||
])
|
||||
->group(['targetId', 'targetType'])
|
||||
->limit($offset, $maxSize + 1)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
namespace Espo\Tools\AdminNotifications\Jobs;
|
||||
|
||||
use Espo\Core\Job\JobDataLess;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Config\ConfigWriter;
|
||||
use Espo\Entities\Extension;
|
||||
@@ -66,7 +67,7 @@ class CheckNewExtensionVersion implements JobDataLess
|
||||
'deleted' => false,
|
||||
'isInstalled' => true,
|
||||
])
|
||||
->order(['createdAt'])
|
||||
->order([Field::CREATED_AT])
|
||||
->build();
|
||||
|
||||
$sth = $this->entityManager->getQueryExecutor()->execute($query);
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\AdminNotifications;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\Language;
|
||||
use Espo\Core\Utils\ScheduledJob;
|
||||
@@ -200,7 +201,7 @@ class Manager
|
||||
'name' => $extensionName,
|
||||
'isInstalled' => true,
|
||||
])
|
||||
->order('createdAt', true)
|
||||
->order(Field::CREATED_AT, true)
|
||||
->findOne();
|
||||
|
||||
if (!$extension) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\EmailNotification;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Entity;
|
||||
use Espo\Core\ORM\Type\FieldType;
|
||||
use Espo\Entities\Email;
|
||||
@@ -123,7 +124,7 @@ class AssignmentProcessor
|
||||
|
||||
$this->loadParentNameFields($entity);
|
||||
|
||||
if (!$entity->hasLinkMultipleField('assignedUsers')) {
|
||||
if (!$entity->hasLinkMultipleField(Field::ASSIGNED_USERS)) {
|
||||
if ($entity->get('assignedUserId') !== $userId) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\EmailNotification;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\ORM\Entity;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\Utils\Config;
|
||||
@@ -76,8 +77,8 @@ class HookProcessor
|
||||
|
||||
private function processMultiple(CoreEntity $entity): void
|
||||
{
|
||||
$userIdList = $entity->getLinkMultipleIdList('assignedUsers');
|
||||
$fetchedAssignedUserIdList = $entity->getFetched('assignedUsersIds') ?? [];
|
||||
$userIdList = $entity->getLinkMultipleIdList(Field::ASSIGNED_USERS);
|
||||
$fetchedAssignedUserIdList = $entity->getFetched(Field::ASSIGNED_USERS . 'Ids') ?? [];
|
||||
|
||||
foreach ($userIdList as $userId) {
|
||||
if (
|
||||
@@ -99,7 +100,7 @@ class HookProcessor
|
||||
|
||||
$hasAssignedUserField =
|
||||
$entity->has('assignedUserId') ||
|
||||
$entity->hasLinkMultipleField('assignedUsers') &&
|
||||
$entity->hasLinkMultipleField(Field::ASSIGNED_USERS) &&
|
||||
$entity->has('assignedUsersIds');
|
||||
|
||||
if (!$hasAssignedUserField) {
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\EntityManager\Hook\Hooks;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Type\FieldType;
|
||||
use Espo\Core\Utils\Log;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
@@ -43,9 +44,9 @@ use Espo\Tools\EntityManager\Params;
|
||||
class AssignedUsersUpdateHook implements UpdateHook
|
||||
{
|
||||
private const PARAM = 'assignedUsers';
|
||||
private const FIELD = 'assignedUsers';
|
||||
private const FIELD = Field::ASSIGNED_USERS;
|
||||
private const RELATION_NAME = 'entityUser';
|
||||
private const FIELD_ASSIGNED_USER = 'assignedUser';
|
||||
private const FIELD_ASSIGNED_USER = Field::ASSIGNED_USER;
|
||||
|
||||
private const DEFAULT_MAX_COUNT = 10;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\Import;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Exception;
|
||||
use GuzzleHttp\Psr7\Utils as Psr7Utils;
|
||||
|
||||
@@ -227,7 +228,7 @@ class Service
|
||||
|
||||
$removeFromDb = false;
|
||||
|
||||
$createdAt = $import->get('createdAt');
|
||||
$createdAt = $import->get(Field::CREATED_AT);
|
||||
|
||||
if ($createdAt) {
|
||||
$dtNow = new DateTime();
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\Notification;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Id\RecordIdGenerator;
|
||||
use Espo\Entities\Note;
|
||||
use Espo\Entities\Notification;
|
||||
@@ -128,7 +129,7 @@ class Service
|
||||
],
|
||||
'type' => Notification::TYPE_NOTE,
|
||||
'userId' => $userId,
|
||||
'createdAt' => $now,
|
||||
Field::CREATED_AT => $now,
|
||||
'relatedId' => $note->getId(),
|
||||
'relatedType' => Note::ENTITY_TYPE,
|
||||
'relatedParentId' => $note->getParentId(),
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Espo\Tools\Stars;
|
||||
|
||||
use Espo\Core\Exceptions\Error\Body;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Utils\Config;
|
||||
use Espo\Core\Utils\DateTime;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
@@ -86,7 +87,7 @@ class StarService
|
||||
'entityId' => $entity->getId(),
|
||||
'entityType' => $entity->getEntityType(),
|
||||
'userId' => $user->getId(),
|
||||
'createdAt' => DateTime::getSystemNowString(),
|
||||
Field::CREATED_AT => DateTime::getSystemNowString(),
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
if ((int) $e->getCode() === 23000) {
|
||||
|
||||
@@ -36,6 +36,7 @@ use Espo\Core\Api\Response;
|
||||
use Espo\Core\Api\ResponseComposer;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Record\SearchParamsFetcher;
|
||||
use Espo\Core\Select\SearchParams;
|
||||
use Espo\Core\Select\Where\Item as WhereItem;
|
||||
@@ -83,7 +84,7 @@ class GetGlobal implements Action
|
||||
->withWhereAdded(
|
||||
WhereItem
|
||||
::createBuilder()
|
||||
->setAttribute('createdAt')
|
||||
->setAttribute(Field::CREATED_AT)
|
||||
->setType(WhereItem\Type::AFTER)
|
||||
->setValue($after)
|
||||
->build()
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
namespace Espo\Tools\Stream;
|
||||
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\ORM\Repository\Option\SaveOption;
|
||||
use Espo\Core\ORM\Entity as CoreEntity;
|
||||
use Espo\Core\Utils\Metadata;
|
||||
@@ -62,7 +63,7 @@ class HookProcessor
|
||||
/** @var ?array<string, ?string> */
|
||||
private $statusFields = null;
|
||||
|
||||
private const FIELD_ASSIGNED_USERS = 'assignedUsers';
|
||||
private const FIELD_ASSIGNED_USERS = Field::ASSIGNED_USERS;
|
||||
|
||||
public function __construct(
|
||||
private Metadata $metadata,
|
||||
@@ -343,7 +344,7 @@ class HookProcessor
|
||||
$entityType = $entity->getEntityType();
|
||||
|
||||
$multipleField = $this->metadata->get(['streamDefs', $entityType, 'followingUsersField']) ??
|
||||
'assignedUsers';
|
||||
Field::ASSIGNED_USERS;
|
||||
|
||||
$hasAssignedUsersField = $entity->hasLinkMultipleField($multipleField);
|
||||
|
||||
@@ -447,7 +448,7 @@ class HookProcessor
|
||||
}
|
||||
|
||||
$multipleField = $this->metadata->get(['streamDefs', $entity->getEntityType(), 'followingUsersField']) ??
|
||||
'assignedUsers';
|
||||
Field::ASSIGNED_USERS;
|
||||
|
||||
if (!$entity->hasLinkMultipleField($multipleField)) {
|
||||
return;
|
||||
|
||||
@@ -217,7 +217,7 @@ class Processor
|
||||
'isInternal',
|
||||
'relatedType',
|
||||
'relatedId',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
])
|
||||
->order('number', Order::DESC)
|
||||
->limit(0, $limit)
|
||||
|
||||
@@ -34,6 +34,7 @@ use Espo\Core\Acl\Table;
|
||||
use Espo\Core\AclManager;
|
||||
use Espo\Core\Exceptions\BadRequest;
|
||||
use Espo\Core\Exceptions\Forbidden;
|
||||
use Espo\Core\Name\Field;
|
||||
use Espo\Core\Select\SearchParams;
|
||||
use Espo\Core\Select\SelectBuilderFactory;
|
||||
use Espo\Entities\Note;
|
||||
@@ -102,7 +103,7 @@ class QueryHelper
|
||||
'relatedType',
|
||||
'relatedId',
|
||||
'targetType',
|
||||
'createdAt',
|
||||
Field::CREATED_AT,
|
||||
'createdById',
|
||||
'createdByName',
|
||||
'isGlobal',
|
||||
|
||||
@@ -89,7 +89,7 @@ class Service
|
||||
'Closed Lost',
|
||||
];
|
||||
|
||||
private const FIELD_ASSIGNED_USERS = 'assignedUsers';
|
||||
private const FIELD_ASSIGNED_USERS = Field::ASSIGNED_USERS;
|
||||
|
||||
/**
|
||||
* @var array<
|
||||
|
||||
Reference in New Issue
Block a user