type fixes
This commit is contained in:
@@ -96,12 +96,26 @@ class Admin
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getActionJobs(): array
|
||||
{
|
||||
return $this->scheduledJob->getAvailableList();
|
||||
}
|
||||
|
||||
public function postActionUploadUpgradePackage($params, $data)
|
||||
|
||||
/**
|
||||
* @todo Use Request.
|
||||
*
|
||||
* @param array<string,mixed> $params
|
||||
* @param string $data
|
||||
* @return array{
|
||||
* id: string,
|
||||
* version: string,
|
||||
* }
|
||||
*/
|
||||
public function postActionUploadUpgradePackage($params, $data): array
|
||||
{
|
||||
if ($this->config->get('restrictedMode')) {
|
||||
if (!$this->user->isSuperAdmin()) {
|
||||
@@ -137,16 +151,32 @@ class Admin
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{
|
||||
* message: string,
|
||||
* command: string,
|
||||
* }
|
||||
*/
|
||||
public function actionCronMessage(): array
|
||||
{
|
||||
return $this->scheduledJob->getSetupMessage();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int,array{id:string,type:string,message:string}>
|
||||
*/
|
||||
public function actionAdminNotificationList(): array
|
||||
{
|
||||
return $this->adminNotificationManager->getNotificationList();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{
|
||||
* php: array<string,array<string,mixed>>,
|
||||
* database: array<string,array<string,mixed>>,
|
||||
* permission: array<string,array{type:string,acceptable:int}>,
|
||||
* }
|
||||
*/
|
||||
public function actionSystemRequirementList(): array
|
||||
{
|
||||
return $this->systemRequirements->getAllRequiredList();
|
||||
|
||||
@@ -61,7 +61,7 @@ class Email extends Record
|
||||
/**
|
||||
* @todo Move to service.
|
||||
*/
|
||||
public function postActionSendTestEmail(Request $request)
|
||||
public function postActionSendTestEmail(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -142,10 +142,12 @@ class Email extends Record
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getEmailService()->sendTestEmail(get_object_vars($data));
|
||||
$this->getEmailService()->sendTestEmail(get_object_vars($data));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postActionMarkAsRead(Request $request)
|
||||
public function postActionMarkAsRead(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -161,7 +163,9 @@ class Email extends Record
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getEmailService()->markAsReadByIdList($idList);
|
||||
$this->getEmailService()->markAsReadByIdList($idList);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public function postActionMarkAsNotRead(Request $request): bool
|
||||
@@ -304,7 +308,7 @@ class Email extends Record
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getActionGetInsertFieldData(Request $request)
|
||||
public function getActionGetInsertFieldData(Request $request): stdClass
|
||||
{
|
||||
if (!$this->acl->checkScope('Email', 'create')) {
|
||||
throw new Forbidden();
|
||||
|
||||
@@ -40,6 +40,9 @@ use Espo\Core\{
|
||||
|
||||
class EmailAddress extends RecordBase
|
||||
{
|
||||
/**
|
||||
* @return array<int,array<string,mixed>>
|
||||
*/
|
||||
public function actionSearchInAddressBook(Request $request): array
|
||||
{
|
||||
if (!$this->acl->checkScope('Email')) {
|
||||
|
||||
@@ -66,6 +66,11 @@ class EmailFolder extends RecordBase
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{
|
||||
* list:array<array<string,mixed>>
|
||||
* }
|
||||
*/
|
||||
public function getActionListAll(): array
|
||||
{
|
||||
return $this->getEmailFolderService()->listAll();
|
||||
|
||||
@@ -142,7 +142,7 @@ class ExternalAccount extends RecordBase
|
||||
return $entity->getValueMap();
|
||||
}
|
||||
|
||||
public function postActionAuthorizationCode(Request $request)
|
||||
public function postActionAuthorizationCode(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -155,7 +155,9 @@ class ExternalAccount extends RecordBase
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
return $this->getExternalAccount()->authorizationCode($integration, $userId, $code);
|
||||
$this->getExternalAccount()->authorizationCode($integration, $userId, $code);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function getExternalAccount(): Service
|
||||
|
||||
@@ -44,11 +44,11 @@ use Espo\Core\{
|
||||
|
||||
class FieldManager
|
||||
{
|
||||
protected $user;
|
||||
private $user;
|
||||
|
||||
protected $dataManager;
|
||||
private $dataManager;
|
||||
|
||||
protected $fieldManagerTool;
|
||||
private $fieldManagerTool;
|
||||
|
||||
public function __construct(User $user, DataManager $dataManager, FieldManagerTool $fieldManagerTool)
|
||||
{
|
||||
@@ -59,14 +59,17 @@ class FieldManager
|
||||
$this->checkControllerAccess();
|
||||
}
|
||||
|
||||
protected function checkControllerAccess()
|
||||
protected function checkControllerAccess(): void
|
||||
{
|
||||
if (!$this->user->isAdmin()) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
}
|
||||
|
||||
public function getActionRead(Request $request)
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function getActionRead(Request $request): array
|
||||
{
|
||||
$scope = $request->getRouteParam('scope');
|
||||
$name = $request->getRouteParam('name');
|
||||
@@ -75,16 +78,13 @@ class FieldManager
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
$data = $this->fieldManagerTool->read($scope, $name);
|
||||
|
||||
if (!isset($data)) {
|
||||
throw new BadRequest();
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $this->fieldManagerTool->read($scope, $name);
|
||||
}
|
||||
|
||||
public function postActionCreate(Request $request)
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function postActionCreate(Request $request): array
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -111,12 +111,18 @@ class FieldManager
|
||||
return $fieldManagerTool->read($scope, $data->name);
|
||||
}
|
||||
|
||||
public function patchActionUpdate(Request $request)
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function patchActionUpdate(Request $request): array
|
||||
{
|
||||
return $this->putActionUpdate($request);
|
||||
}
|
||||
|
||||
public function putActionUpdate(Request $request)
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function putActionUpdate(Request $request): array
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
@@ -140,7 +146,7 @@ class FieldManager
|
||||
return $fieldManagerTool->read($scope, $name);
|
||||
}
|
||||
|
||||
public function deleteActionDelete(Request $request)
|
||||
public function deleteActionDelete(Request $request): bool
|
||||
{
|
||||
$scope = $request->getRouteParam('scope');
|
||||
$name = $request->getRouteParam('name');
|
||||
@@ -156,7 +162,7 @@ class FieldManager
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function postActionResetToDefault(Request $request)
|
||||
public function postActionResetToDefault(Request $request): bool
|
||||
{
|
||||
$data = $request->getParsedBody();
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ class I18n
|
||||
$this->service = $service;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
public function getActionRead(Request $request): array
|
||||
{
|
||||
$default = $request->getQueryParam('default') === 'true';
|
||||
|
||||
@@ -97,6 +97,9 @@ class LeadCapture extends Record
|
||||
->getValueMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return stdClass[]
|
||||
*/
|
||||
public function getActionSmtpAccountDataList(): array
|
||||
{
|
||||
if (!$this->getUser()->isAdmin()) {
|
||||
|
||||
@@ -115,6 +115,9 @@ class MassAction
|
||||
$response->writeBody('true');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string,mixed>
|
||||
*/
|
||||
private function prepareMassActionParams(stdClass $data): array
|
||||
{
|
||||
$where = $data->where ?? null;
|
||||
|
||||
@@ -47,6 +47,9 @@ class Metadata extends Base
|
||||
return $this->getMetadataService()->getDataForFrontend();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getActionGet(Request $request)
|
||||
{
|
||||
if (!$this->user->isAdmin()) {
|
||||
|
||||
@@ -40,7 +40,7 @@ use stdClass;
|
||||
|
||||
class Stream
|
||||
{
|
||||
public static $defaultAction = 'list';
|
||||
public static string $defaultAction = 'list';
|
||||
|
||||
private $service;
|
||||
|
||||
|
||||
@@ -92,6 +92,9 @@ class RecordTree extends Record
|
||||
return $this->getRecordTreeService()->getLastChildrenIdList($parentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Service<\Espo\Core\ORM\Entity>
|
||||
*/
|
||||
protected function getRecordTreeService(): Service
|
||||
{
|
||||
$service = $this->getRecordService();
|
||||
|
||||
@@ -33,7 +33,7 @@ use Espo\Core\Acl;
|
||||
|
||||
trait AclSetter
|
||||
{
|
||||
/*
|
||||
/**
|
||||
* @var Acl
|
||||
*/
|
||||
protected $acl;
|
||||
|
||||
@@ -33,6 +33,9 @@ use Espo\Core\Select\SelectManagerFactory;
|
||||
|
||||
trait SelectManagerFactorySetter
|
||||
{
|
||||
/**
|
||||
* @var SelectManagerFactory
|
||||
*/
|
||||
protected $selectManagerFactory;
|
||||
|
||||
public function setSelectManagerFactory(SelectManagerFactory $selectManagerFactory): void
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Base>
|
||||
*/
|
||||
class Base extends \Espo\Services\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\BasePlus>
|
||||
*/
|
||||
class BasePlus extends \Espo\Services\Record
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\RecordTree<\Espo\Core\Templates\Entities\CategoryTree>
|
||||
*/
|
||||
class CategoryTree extends \Espo\Services\RecordTree
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Company>
|
||||
*/
|
||||
class Company extends \Espo\Services\Record
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Event>
|
||||
*/
|
||||
class Event extends \Espo\Services\Record
|
||||
{
|
||||
protected $validateRequiredSkipFieldList = [
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
|
||||
namespace Espo\Core\Templates\Services;
|
||||
|
||||
/**
|
||||
* @extends \Espo\Services\Record<\Espo\Core\Templates\Entities\Person>
|
||||
*/
|
||||
class Person extends \Espo\Services\Record
|
||||
{
|
||||
|
||||
|
||||
@@ -34,27 +34,45 @@ trait Injectable
|
||||
{
|
||||
protected $injections = []; /** @phpstan-ignore-line */
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param object $object
|
||||
* @return void
|
||||
*/
|
||||
public function inject($name, $object)
|
||||
{
|
||||
$this->injections[$name] = $object;
|
||||
}
|
||||
|
||||
public function getDependencyList() : array /** @phpstan-ignore-line */
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getDependencyList(): array
|
||||
{
|
||||
return $this->dependencyList;
|
||||
}
|
||||
|
||||
protected function getInjection(string $name) /** @phpstan-ignore-line */
|
||||
/**
|
||||
* @return ?object
|
||||
*/
|
||||
protected function getInjection(string $name)
|
||||
{
|
||||
return $this->injections[$name] ?? $this->$name ?? null;
|
||||
}
|
||||
|
||||
protected function addDependency(string $name) /** @phpstan-ignore-line */
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
protected function addDependency(string $name)
|
||||
{
|
||||
$this->dependencyList[] = $name;
|
||||
}
|
||||
|
||||
protected function addDependencyList(array $list) /** @phpstan-ignore-line */
|
||||
/**
|
||||
* @param string[] $list
|
||||
* @return void
|
||||
*/
|
||||
protected function addDependencyList(array $list)
|
||||
{
|
||||
foreach ($list as $item) {
|
||||
$this->addDependency($item);
|
||||
|
||||
@@ -63,7 +63,6 @@ class AdminNotificationManager
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array<int,array{id:string,type:string,message:string}>
|
||||
*/
|
||||
public function getNotificationList(): array
|
||||
|
||||
@@ -54,42 +54,46 @@ class Email extends Entity
|
||||
|
||||
public const STATUS_DRAFT = 'Draft';
|
||||
|
||||
protected function _getSubject()
|
||||
protected function _getSubject(): ?string
|
||||
{
|
||||
return $this->get('name');
|
||||
}
|
||||
|
||||
protected function _setSubject($value)
|
||||
protected function _setSubject(?string $value): void
|
||||
{
|
||||
$this->set('name', $value);
|
||||
}
|
||||
|
||||
protected function _hasSubject()
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _hasSubject(): bool
|
||||
{
|
||||
return $this->has('name');
|
||||
}
|
||||
|
||||
protected function _hasFromName()
|
||||
|
||||
protected function _hasFromName(): bool
|
||||
{
|
||||
return $this->has('fromString');
|
||||
}
|
||||
|
||||
protected function _hasFromAddress()
|
||||
protected function _hasFromAddress(): bool
|
||||
{
|
||||
return $this->has('fromString');
|
||||
}
|
||||
|
||||
protected function _hasReplyToName()
|
||||
protected function _hasReplyToName(): bool
|
||||
{
|
||||
return $this->has('replyToString');
|
||||
}
|
||||
|
||||
protected function _hasReplyToAddress()
|
||||
protected function _hasReplyToAddress(): bool
|
||||
{
|
||||
return $this->has('replyToString');
|
||||
}
|
||||
|
||||
protected function _getFromName()
|
||||
protected function _getFromName(): ?string
|
||||
{
|
||||
if (!$this->has('fromString')) {
|
||||
return null;
|
||||
@@ -104,7 +108,7 @@ class Email extends Entity
|
||||
return $string;
|
||||
}
|
||||
|
||||
protected function _getFromAddress()
|
||||
protected function _getFromAddress(): ?string
|
||||
{
|
||||
if (!$this->has('fromString')) {
|
||||
return null;
|
||||
@@ -113,7 +117,7 @@ class Email extends Entity
|
||||
return EmailService::parseFromAddress($this->get('fromString'));
|
||||
}
|
||||
|
||||
protected function _getReplyToName()
|
||||
protected function _getReplyToName(): ?string
|
||||
{
|
||||
if (!$this->has('replyToString')) {
|
||||
return null;
|
||||
@@ -130,7 +134,7 @@ class Email extends Entity
|
||||
);
|
||||
}
|
||||
|
||||
protected function _getReplyToAddress()
|
||||
protected function _getReplyToAddress(): ?string
|
||||
{
|
||||
if (!$this->has('replyToString')) {
|
||||
return null;
|
||||
@@ -147,7 +151,7 @@ class Email extends Entity
|
||||
);
|
||||
}
|
||||
|
||||
protected function _setIsRead($value)
|
||||
protected function _setIsRead(?bool $value): void
|
||||
{
|
||||
$this->setInContainer('isRead', $value !== false);
|
||||
|
||||
@@ -177,7 +181,7 @@ class Email extends Entity
|
||||
$this->entityManager->saveEntity($attachment);
|
||||
}
|
||||
|
||||
protected function _getBodyPlain()
|
||||
protected function _getBodyPlain(): ?string
|
||||
{
|
||||
return $this->getBodyPlain();
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ class EmailAddress extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'EmailAddress';
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
protected function _setName($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
|
||||
@@ -65,6 +65,9 @@ class Import extends \Espo\Core\ORM\Entity
|
||||
return $this->get('entityType');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?string[]
|
||||
*/
|
||||
public function getTargetAttributeList(): ?array
|
||||
{
|
||||
return $this->get('attributeList');
|
||||
|
||||
@@ -57,7 +57,7 @@ class Note extends Entity
|
||||
|
||||
public const TYPE_CREATE = 'Create';
|
||||
|
||||
private $aclIsProcessed = false;
|
||||
private bool $aclIsProcessed = false;
|
||||
|
||||
public function isPost(): bool
|
||||
{
|
||||
@@ -174,7 +174,7 @@ class Note extends Entity
|
||||
$this->set('attachmentsTypes', $types);
|
||||
}
|
||||
|
||||
public function addNotifiedUserId($userId): void
|
||||
public function addNotifiedUserId(string $userId): void
|
||||
{
|
||||
$userIdList = $this->get('notifiedUserIdList');
|
||||
|
||||
@@ -189,7 +189,7 @@ class Note extends Entity
|
||||
$this->set('notifiedUserIdList', $userIdList);
|
||||
}
|
||||
|
||||
public function isUserIdNotified($userId): bool
|
||||
public function isUserIdNotified(string $userId): bool
|
||||
{
|
||||
$userIdList = $this->get('notifiedUserIdList') ?? [];
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ class PhoneNumber extends Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'PhoneNumber';
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
protected function _setName($value)
|
||||
{
|
||||
if (empty($value)) {
|
||||
|
||||
@@ -33,6 +33,9 @@ class Portal extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Portal';
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $settingsAttributeList = [
|
||||
'companyLogoId',
|
||||
'tabList',
|
||||
@@ -48,6 +51,9 @@ class Portal extends \Espo\Core\ORM\Entity
|
||||
'defaultCurrency',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSettingsAttributeList(): array
|
||||
{
|
||||
return $this->settingsAttributeList;
|
||||
|
||||
@@ -33,6 +33,9 @@ class Preferences extends \Espo\Core\ORM\Entity
|
||||
{
|
||||
public const ENTITY_TYPE = 'Preferences';
|
||||
|
||||
/**
|
||||
* @return ?array<string,mixed>
|
||||
*/
|
||||
public function getSmtpParams(): ?array
|
||||
{
|
||||
$smtpParams = [];
|
||||
|
||||
@@ -114,6 +114,9 @@ class User extends Person
|
||||
return $this->getValueObject('teams');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getTeamIdList(): array
|
||||
{
|
||||
return $this->getLinkMultipleIdList('teams');
|
||||
@@ -169,6 +172,9 @@ class User extends Person
|
||||
return $this->get('userName');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ?string
|
||||
*/
|
||||
protected function _getName()
|
||||
{
|
||||
if (!$this->hasInContainer('name') || !$this->getFromContainer('name')) {
|
||||
@@ -180,6 +186,9 @@ class User extends Person
|
||||
return $this->getFromContainer('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
protected function _hasName()
|
||||
{
|
||||
if ($this->hasInContainer('name')) {
|
||||
|
||||
@@ -107,6 +107,9 @@ class Attachment implements EntryPoint
|
||||
->setBody($stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getAllowedFileTypeList(): array
|
||||
{
|
||||
return $this->metadata->get(['app', 'image', 'allowedFileTypeList']) ?? [];
|
||||
|
||||
@@ -44,8 +44,11 @@ class Avatar extends Image implements Di\MetadataAware
|
||||
use Di\MetadataSetter;
|
||||
use NotStrictAuth;
|
||||
|
||||
protected $systemColor = '#a4b5bd';
|
||||
protected string $systemColor = '#a4b5bd';
|
||||
|
||||
/**
|
||||
* @var array<int,string|array{int,int,int}>
|
||||
*/
|
||||
protected $colorList = [
|
||||
[111, 168, 214],
|
||||
[237, 197, 85],
|
||||
@@ -58,7 +61,10 @@ class Avatar extends Image implements Di\MetadataAware
|
||||
'#E8AF64',
|
||||
];
|
||||
|
||||
protected function getColor($hash)
|
||||
/**
|
||||
* @return string|array{int,int,int}
|
||||
*/
|
||||
protected function getColor(string $hash)
|
||||
{
|
||||
$length = strlen($hash);
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@ use Espo\Core\{
|
||||
|
||||
class Download implements EntryPoint
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fileTypesToShowInline = [
|
||||
'application/pdf',
|
||||
'application/vnd.ms-word',
|
||||
|
||||
@@ -52,8 +52,14 @@ use Espo\Entities\Attachment;
|
||||
|
||||
class Image implements EntryPoint
|
||||
{
|
||||
/**
|
||||
* @var ?string[]
|
||||
*/
|
||||
protected $allowedRelatedTypeList = null;
|
||||
|
||||
/**
|
||||
* @var ?string[]
|
||||
*/
|
||||
protected $allowedFieldList = null;
|
||||
|
||||
/** @var FileStorageManager */
|
||||
@@ -228,6 +234,9 @@ class Image implements EntryPoint
|
||||
return $contents;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return resource|\GdImage
|
||||
*/
|
||||
protected function createThumbImage(string $filePath, string $fileType, string $size)
|
||||
{
|
||||
if (!is_array(getimagesize($filePath))) {
|
||||
@@ -324,7 +333,11 @@ class Image implements EntryPoint
|
||||
return $targetImage;
|
||||
}
|
||||
|
||||
protected function getOrientation($filePath)
|
||||
/**
|
||||
* @param string $filePath
|
||||
* @return ?int
|
||||
*/
|
||||
protected function getOrientation(string $filePath)
|
||||
{
|
||||
$orientation = 0;
|
||||
|
||||
@@ -335,7 +348,11 @@ class Image implements EntryPoint
|
||||
return $orientation;
|
||||
}
|
||||
|
||||
protected function fixOrientation($targetImage, $filePath)
|
||||
/**
|
||||
* @param resource|\GdImage $targetImage
|
||||
* @return resource|\GdImage
|
||||
*/
|
||||
protected function fixOrientation($targetImage, string $filePath)
|
||||
{
|
||||
$orientation = $this->getOrientation($filePath);
|
||||
|
||||
@@ -348,21 +365,33 @@ class Image implements EntryPoint
|
||||
return $targetImage;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getAllowedFileTypeList(): array
|
||||
{
|
||||
return $this->metadata->get(['app', 'image', 'allowedFileTypeList']) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getResizableFileTypeList(): array
|
||||
{
|
||||
return $this->metadata->get(['app', 'image', 'resizableFileTypeList']) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function getFixOrientationFileTypeList(): array
|
||||
{
|
||||
return $this->metadata->get(['app', 'image', 'fixOrientationFileTypeList']) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string,array{int,int}>
|
||||
*/
|
||||
protected function getSizes(): array
|
||||
{
|
||||
return $this->metadata->get(['app', 'image', 'sizes']) ?? [];
|
||||
|
||||
@@ -762,7 +762,7 @@ class Activities implements
|
||||
|
||||
protected function accessCheck(Entity $entity): void
|
||||
{
|
||||
if ($entity->getEntityType() == 'User') {
|
||||
if ($entity instanceof UserEntity) {
|
||||
if (!$this->acl->checkUserPermission($entity, 'user')) {
|
||||
throw new Forbidden();
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ class FieldManager
|
||||
{
|
||||
$fieldDefs = $this->getFieldDefs($scope, $name);
|
||||
|
||||
if ($fieldDefs === null) {
|
||||
throw new Error("Can't read field defs {$scope}.{$name}.");
|
||||
}
|
||||
|
||||
$fieldDefs['label'] = $this->language->translate($name, 'fields', $scope);
|
||||
|
||||
$type = $this->metadata->get(['entityDefs', $scope, 'fields', $name, 'type']);
|
||||
|
||||
Reference in New Issue
Block a user