Merge branch 'fix'
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/************************************************************************
|
||||||
|
* This file is part of EspoCRM.
|
||||||
|
*
|
||||||
|
* EspoCRM – Open Source CRM application.
|
||||||
|
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||||
|
* Website: https://www.espocrm.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
|
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
namespace Espo\Classes\FieldValidators\WorkingTimeRange\Calendars;
|
||||||
|
|
||||||
|
use Espo\Core\FieldValidation\Validator;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Data;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Failure;
|
||||||
|
use Espo\Entities\WorkingTimeRange;
|
||||||
|
use Espo\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements Validator<WorkingTimeRange>
|
||||||
|
*/
|
||||||
|
class OnlyIfNoUsers implements Validator
|
||||||
|
{
|
||||||
|
public function validate(Entity $entity, string $field, Data $data): ?Failure
|
||||||
|
{
|
||||||
|
if ($entity->getCalendars()->getCount() === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($entity->getUsers()->getCount() === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Failure::create();
|
||||||
|
}
|
||||||
|
}
|
||||||
+52
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
/************************************************************************
|
||||||
|
* This file is part of EspoCRM.
|
||||||
|
*
|
||||||
|
* EspoCRM – Open Source CRM application.
|
||||||
|
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||||
|
* Website: https://www.espocrm.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
|
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
namespace Espo\Classes\FieldValidators\WorkingTimeRange\Calendars;
|
||||||
|
|
||||||
|
use Espo\Core\FieldValidation\Validator;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Data;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Failure;
|
||||||
|
use Espo\Entities\WorkingTimeRange;
|
||||||
|
use Espo\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements Validator<WorkingTimeRange>
|
||||||
|
*/
|
||||||
|
class RequiredIfNoUsers implements Validator
|
||||||
|
{
|
||||||
|
|
||||||
|
public function validate(Entity $entity, string $field, Data $data): ?Failure
|
||||||
|
{
|
||||||
|
if ($entity->getCalendars()->getCount() !== 0 || $entity->getUsers()->getCount() !== 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Failure::create();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
/************************************************************************
|
||||||
|
* This file is part of EspoCRM.
|
||||||
|
*
|
||||||
|
* EspoCRM – Open Source CRM application.
|
||||||
|
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||||
|
* Website: https://www.espocrm.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
|
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
namespace Espo\Classes\FieldValidators\WorkingTimeRange\Users;
|
||||||
|
|
||||||
|
use Espo\Core\FieldValidation\Validator;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Data;
|
||||||
|
use Espo\Core\FieldValidation\Validator\Failure;
|
||||||
|
use Espo\Entities\WorkingTimeRange;
|
||||||
|
use Espo\ORM\Entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements Validator<WorkingTimeRange>
|
||||||
|
*/
|
||||||
|
class OnlyIfNoCalendars implements Validator
|
||||||
|
{
|
||||||
|
public function validate(Entity $entity, string $field, Data $data): ?Failure
|
||||||
|
{
|
||||||
|
if ($entity->getUsers()->getCount() === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($entity->getCalendars()->getCount() === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Failure::create();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -65,7 +65,11 @@ class ListLoader implements LoaderInterface
|
|||||||
foreach ($this->getFieldList($entityType) as $field) {
|
foreach ($this->getFieldList($entityType) as $field) {
|
||||||
if (
|
if (
|
||||||
!in_array($field . 'Ids', $select) &&
|
!in_array($field . 'Ids', $select) &&
|
||||||
!in_array($field . 'Names', $select)
|
!in_array($field . 'Names', $select) &&
|
||||||
|
(
|
||||||
|
!$entity->hasAttribute($field . 'Columns') ||
|
||||||
|
!in_array($field . 'Columns', $select)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -128,4 +128,13 @@ class WorkingTimeRange extends Entity
|
|||||||
/** @var LinkMultiple */
|
/** @var LinkMultiple */
|
||||||
return $this->getValueObject('users');
|
return $this->getValueObject('users');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.3.1
|
||||||
|
*/
|
||||||
|
public function getCalendars(): LinkMultiple
|
||||||
|
{
|
||||||
|
/** @var LinkMultiple */
|
||||||
|
return $this->getValueObject('calendars');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,8 +267,12 @@ class Image implements EntryPoint
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($targetWidth < 1 || $targetHeight < 1) {
|
if ($targetWidth < 1) {
|
||||||
throw new RuntimeException("No width or height.");
|
$targetWidth = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($targetHeight < 1) {
|
||||||
|
$targetHeight = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
|
$targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"labels": {
|
"labels": {
|
||||||
"Create ApiUser": "Create API User"
|
"Create ApiUser": "Create API User",
|
||||||
|
"OpenAPI spec": "OpenAPI spec"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,13 @@
|
|||||||
{"name": "timeRanges"},
|
{"name": "timeRanges"},
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
{"name": "users"},
|
||||||
|
false
|
||||||
|
],
|
||||||
[
|
[
|
||||||
{"name": "calendars"},
|
{"name": "calendars"},
|
||||||
{"name": "users"}
|
false
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{"name": "description"}
|
{"name": "description"}
|
||||||
|
|||||||
@@ -13,9 +13,13 @@
|
|||||||
{"name": "timeRanges"},
|
{"name": "timeRanges"},
|
||||||
false
|
false
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
{"name": "users"},
|
||||||
|
false
|
||||||
|
],
|
||||||
[
|
[
|
||||||
{"name": "calendars"},
|
{"name": "calendars"},
|
||||||
{"name": "users"}
|
false
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
{"name": "description"}
|
{"name": "description"}
|
||||||
|
|||||||
@@ -30,5 +30,18 @@
|
|||||||
},
|
},
|
||||||
"filterList": [
|
"filterList": [
|
||||||
],
|
],
|
||||||
"boolFilterList": []
|
"boolFilterList": [],
|
||||||
}
|
"menu": {
|
||||||
|
"list": {
|
||||||
|
"dropdown": [
|
||||||
|
{
|
||||||
|
"name": "openApiSpec",
|
||||||
|
"label": "OpenAPI spec",
|
||||||
|
"link": "api/v1/OpenApi",
|
||||||
|
"handler": "handlers/api-user/open-api-spec-action",
|
||||||
|
"actionFunction": "process"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"type": "decimal",
|
"type": "decimal",
|
||||||
"decimalPlaces": 6,
|
"decimalPlaces": 6,
|
||||||
"min": 0.0001,
|
"min": 0.0001,
|
||||||
"precision": 15,
|
"precision": 20,
|
||||||
"scale": 8,
|
"scale": 8,
|
||||||
"required": true,
|
"required": true,
|
||||||
"audited": true,
|
"audited": true,
|
||||||
|
|||||||
@@ -119,7 +119,8 @@
|
|||||||
},
|
},
|
||||||
"fontFace": {
|
"fontFace": {
|
||||||
"type": "enum",
|
"type": "enum",
|
||||||
"view": "views/template/fields/font-face"
|
"view": "views/template/fields/font-face",
|
||||||
|
"isSorted": true
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "varchar"
|
"type": "varchar"
|
||||||
|
|||||||
@@ -34,12 +34,20 @@
|
|||||||
},
|
},
|
||||||
"calendars": {
|
"calendars": {
|
||||||
"type": "linkMultiple",
|
"type": "linkMultiple",
|
||||||
"tooltip": true
|
"tooltip": true,
|
||||||
|
"validatorClassNameList": [
|
||||||
|
"Espo\\Classes\\FieldValidators\\WorkingTimeRange\\Calendars\\OnlyIfNoUsers",
|
||||||
|
"Espo\\Classes\\FieldValidators\\WorkingTimeRange\\Calendars\\RequiredIfNoUsers"
|
||||||
|
],
|
||||||
|
"autocompleteOnEmpty": true
|
||||||
},
|
},
|
||||||
"users": {
|
"users": {
|
||||||
"type": "linkMultiple",
|
"type": "linkMultiple",
|
||||||
"view": "views/working-time-range/fields/users",
|
"view": "views/working-time-range/fields/users",
|
||||||
"tooltip": true
|
"tooltip": true,
|
||||||
|
"validatorClassNameList": [
|
||||||
|
"Espo\\Classes\\FieldValidators\\WorkingTimeRange\\Users\\OnlyIfNoCalendars"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"createdAt": {
|
"createdAt": {
|
||||||
"type": "datetime",
|
"type": "datetime",
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"users": {
|
"calendars": {
|
||||||
"visible": {
|
"visible": {
|
||||||
"conditionGroup": [
|
"conditionGroup": [
|
||||||
{
|
{
|
||||||
@@ -19,8 +19,36 @@
|
|||||||
"value": [
|
"value": [
|
||||||
{
|
{
|
||||||
"type": "isNotEmpty",
|
"type": "isNotEmpty",
|
||||||
"attribute": "id"
|
"attribute": "calendarsIds"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "isEmpty",
|
||||||
|
"attribute": "usersIds"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"users": {
|
||||||
|
"required": {
|
||||||
|
"conditionGroup": [
|
||||||
|
{
|
||||||
|
"type": "or",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"type": "isEmpty",
|
||||||
|
"attribute": "calendarsIds"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"visible": {
|
||||||
|
"conditionGroup": [
|
||||||
|
{
|
||||||
|
"type": "or",
|
||||||
|
"value": [
|
||||||
{
|
{
|
||||||
"type": "isNotEmpty",
|
"type": "isNotEmpty",
|
||||||
"attribute": "usersIds"
|
"attribute": "usersIds"
|
||||||
|
|||||||
@@ -724,6 +724,7 @@ class EntityManager
|
|||||||
'collection.order',
|
'collection.order',
|
||||||
'collection.textFilterFields',
|
'collection.textFilterFields',
|
||||||
'collection.fullTextSearch',
|
'collection.fullTextSearch',
|
||||||
|
'collection.countDisabled',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
foreach ($this->getAdditionalParamLocationMap($name) as $it) {
|
foreach ($this->getAdditionalParamLocationMap($name) as $it) {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ class Service
|
|||||||
|
|
||||||
$this->entityManager->saveEntity($entity);
|
$this->entityManager->saveEntity($entity);
|
||||||
|
|
||||||
|
$service->loadAdditionalFields($entity);
|
||||||
$service->prepareEntityForOutput($entity);
|
$service->prepareEntityForOutput($entity);
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
@@ -108,6 +109,7 @@ class Service
|
|||||||
|
|
||||||
$this->entityManager->saveEntity($entity);
|
$this->entityManager->saveEntity($entity);
|
||||||
|
|
||||||
|
$service->loadAdditionalFields($entity);
|
||||||
$service->prepareEntityForOutput($entity);
|
$service->prepareEntityForOutput($entity);
|
||||||
|
|
||||||
return $entity;
|
return $entity;
|
||||||
|
|||||||
@@ -472,12 +472,15 @@ class RecordService
|
|||||||
|
|
||||||
private function prepareSetFields(Notification $entity): void
|
private function prepareSetFields(Notification $entity): void
|
||||||
{
|
{
|
||||||
if ($entity->getRelated() && $entity->getData()?->relatedName) {
|
$relatedName = $entity->getData()->relatedName ?? null;
|
||||||
$entity->set('relatedName', $entity->getData()->relatedName);
|
$createdByName = $entity->getData()->createdByName ?? null;
|
||||||
|
|
||||||
|
if ($entity->getRelated() && $relatedName !== null) {
|
||||||
|
$entity->set('relatedName', $relatedName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($entity->getCreatedBy() && $entity->getData()?->createdByName) {
|
if ($entity->getCreatedBy() && $createdByName !== null) {
|
||||||
$entity->set('createdByName', $entity->getData()->createdByName);
|
$entity->set('createdByName', $createdByName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,33 +30,61 @@
|
|||||||
namespace Espo\Tools\Pdf\Dompdf;
|
namespace Espo\Tools\Pdf\Dompdf;
|
||||||
|
|
||||||
use Dompdf\Dompdf;
|
use Dompdf\Dompdf;
|
||||||
|
use Dompdf\FontMetrics;
|
||||||
use Dompdf\Options;
|
use Dompdf\Options;
|
||||||
use Espo\Core\Utils\Config;
|
use Espo\Core\Utils\Config;
|
||||||
|
use Espo\Core\Utils\File\Manager as FileManager;
|
||||||
|
use Espo\Core\Utils\Metadata;
|
||||||
use Espo\Tools\Pdf\Params;
|
use Espo\Tools\Pdf\Params;
|
||||||
use Espo\Tools\Pdf\Template;
|
use Espo\Tools\Pdf\Template;
|
||||||
|
|
||||||
class DompdfInitializer
|
class DompdfInitializer
|
||||||
{
|
{
|
||||||
private string $defaultFontFace = 'DejaVu Sans';
|
private string $defaultFontFace = 'DejaVu Sans';
|
||||||
|
private string $cacheDir = 'data/cache/application/dompdf';
|
||||||
|
private string $pdfaCacheDir = 'data/cache/application/pdfa-dompdf';
|
||||||
|
|
||||||
private const PT = 2.83465;
|
private const PT = 2.83465;
|
||||||
|
|
||||||
|
/** @var array<string, string> */
|
||||||
|
private array $standardFontMapping = [
|
||||||
|
'courier' => 'DejaVu Sans Mono',
|
||||||
|
'fixed' => 'DejaVu Sans Mono',
|
||||||
|
'helvetica' => 'DejaVu Sans',
|
||||||
|
'monospace' => 'DejaVu Sans Mono',
|
||||||
|
'sans-serif' => 'DejaVu Sans',
|
||||||
|
'serif' => 'DejaVu Serif',
|
||||||
|
'times' => 'DejaVu Serif',
|
||||||
|
'times-roman' => 'DejaVu Serif',
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private Config $config,
|
private Config $config,
|
||||||
|
private Metadata $metadata,
|
||||||
|
private FileManager $fileManager,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function initialize(Template $template, Params $params): Dompdf
|
public function initialize(Template $template, Params $params): Dompdf
|
||||||
{
|
{
|
||||||
$options = new Options();
|
$options = new Options();
|
||||||
|
|
||||||
$options->setIsPdfAEnabled($params->isPdfA());
|
$options
|
||||||
$options->setDefaultFont($this->getFontFace($template));
|
->setIsPdfAEnabled($params->isPdfA())
|
||||||
|
->setDefaultFont($this->getFontFace($template))
|
||||||
|
->setIsJavascriptEnabled(false);
|
||||||
|
|
||||||
|
$dir = $params->isPdfA() ? $this->pdfaCacheDir : $this->cacheDir;
|
||||||
|
|
||||||
|
$options->setFontDir($dir);
|
||||||
|
$options->setFontCache($dir);
|
||||||
|
|
||||||
|
if (!$this->fileManager->isDir($dir)) {
|
||||||
|
$this->fileManager->mkdir($dir);
|
||||||
|
}
|
||||||
|
|
||||||
$pdf = new Dompdf($options);
|
$pdf = new Dompdf($options);
|
||||||
|
|
||||||
if ($params->isPdfA()) {
|
$this->mapFonts($pdf, $params->isPdfA(), $dir);
|
||||||
$this->mapFonts($pdf);
|
|
||||||
}
|
|
||||||
|
|
||||||
$size = $template->getPageFormat() === Template::PAGE_FORMAT_CUSTOM ?
|
$size = $template->getPageFormat() === Template::PAGE_FORMAT_CUSTOM ?
|
||||||
[0.0, 0.0, $template->getPageWidth() * self::PT, $template->getPageHeight() * self::PT] :
|
[0.0, 0.0, $template->getPageWidth() * self::PT, $template->getPageHeight() * self::PT] :
|
||||||
@@ -79,18 +107,36 @@ class DompdfInitializer
|
|||||||
$this->defaultFontFace;
|
$this->defaultFontFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mapFonts(Dompdf $pdf): void
|
private function mapFonts(Dompdf $pdf, bool $isPdfA, string $dir): void
|
||||||
{
|
{
|
||||||
// Fonts are included in PDF/A. Map standard fonts to open source analogues.
|
$file = $dir . '/' . FontMetrics::USER_FONTS_FILE;
|
||||||
|
|
||||||
|
if ($this->fileManager->exists($file)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When fonts are included in PDF/A, we need to map standard fonts to open source analogues.
|
||||||
|
// Also need to support popular fonts specified in CSS styles.
|
||||||
$fontMetrics = $pdf->getFontMetrics();
|
$fontMetrics = $pdf->getFontMetrics();
|
||||||
|
|
||||||
$fontMetrics->setFontFamily('courier', $fontMetrics->getFamily('DejaVu Sans Mono'));
|
if ($isPdfA) {
|
||||||
$fontMetrics->setFontFamily('fixed', $fontMetrics->getFamily('DejaVu Sans Mono'));
|
foreach ($this->standardFontMapping as $key => $value) {
|
||||||
$fontMetrics->setFontFamily('helvetica', $fontMetrics->getFamily('DejaVu Sans'));
|
$fontMetrics->setFontFamily($key, $fontMetrics->getFamily($value));
|
||||||
$fontMetrics->setFontFamily('monospace', $fontMetrics->getFamily('DejaVu Sans Mono'));
|
}
|
||||||
$fontMetrics->setFontFamily('sans-serif', $fontMetrics->getFamily('DejaVu Sans'));
|
|
||||||
$fontMetrics->setFontFamily('serif', $fontMetrics->getFamily('DejaVu Serif'));
|
return;
|
||||||
$fontMetrics->setFontFamily('times', $fontMetrics->getFamily('DejaVu Serif'));
|
}
|
||||||
$fontMetrics->setFontFamily('times-roman', $fontMetrics->getFamily('DejaVu Serif'));
|
|
||||||
|
/** @var string[] $fontList */
|
||||||
|
$fontList = $this->metadata->get('app.pdfEngines.Dompdf.fontFaceList') ?? [];
|
||||||
|
$fontList = array_map(fn ($it) => strtolower($it), $fontList);
|
||||||
|
|
||||||
|
foreach ($this->standardFontMapping as $key => $value) {
|
||||||
|
if (in_array(strtolower($key), $fontList)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fontMetrics->setFontFamily($key, $fontMetrics->getFamily($value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file is part of EspoCRM.
|
||||||
|
*
|
||||||
|
* EspoCRM – Open Source CRM application.
|
||||||
|
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||||
|
* Website: https://www.espocrm.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
|
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
import ActionHandler from 'action-handler';
|
||||||
|
import {inject} from 'di';
|
||||||
|
import Router from 'router';
|
||||||
|
|
||||||
|
// noinspection JSUnusedGlobalSymbols
|
||||||
|
export default class extends ActionHandler {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Router}
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
@inject(Router)
|
||||||
|
router
|
||||||
|
|
||||||
|
process() {
|
||||||
|
window.open('api/v1/OpenApi', '_blank');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file is part of EspoCRM.
|
||||||
|
*
|
||||||
|
* EspoCRM – Open Source CRM application.
|
||||||
|
* Copyright (C) 2014-2026 EspoCRM, Inc.
|
||||||
|
* Website: https://www.espocrm.com
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The interactive user interfaces in modified source and object code versions
|
||||||
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
|
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 9.3.1
|
||||||
|
*/
|
||||||
|
export default class LinkFieldIconHelper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {import('views/fields/link').default} view
|
||||||
|
* @param {{
|
||||||
|
* iconClass: string,
|
||||||
|
* getIconClass: function(): string|null,
|
||||||
|
* getColor: function(): string,
|
||||||
|
* }} options
|
||||||
|
*/
|
||||||
|
constructor(view, options) {
|
||||||
|
this.view = view;
|
||||||
|
this.options = options;
|
||||||
|
|
||||||
|
view.listenTo(view, 'after:render', () => {
|
||||||
|
if (view.isEditMode()) {
|
||||||
|
this.control();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
view.addHandler('keydown', `input[data-name="${view.nameName}"]`, (/** KeyboardEvent */e, target) => {
|
||||||
|
if (e.code === 'Enter') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
target.classList.add('being-typed');
|
||||||
|
});
|
||||||
|
|
||||||
|
view.addHandler('change', `input[data-name="${view.nameName}"]`, (e, target) => {
|
||||||
|
setTimeout(() => target.classList.remove('being-typed'), 200);
|
||||||
|
});
|
||||||
|
|
||||||
|
view.addHandler('blur', `input[data-name="${view.nameName}"]`, (e, target) => {
|
||||||
|
target.classList.remove('being-typed');
|
||||||
|
});
|
||||||
|
|
||||||
|
view.on('change', () => {
|
||||||
|
if (!view.isEditMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const span = view.element.querySelector('span.icon-in-input');
|
||||||
|
|
||||||
|
if (span) {
|
||||||
|
span.parentNode.removeChild(span);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => this.control(), 0);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
control() {
|
||||||
|
const view = this.view;
|
||||||
|
|
||||||
|
const nameElement = view.element.querySelector(`input[data-name="${view.nameName}"]`);
|
||||||
|
nameElement.classList.remove('being-typed');
|
||||||
|
|
||||||
|
const icon = document.createElement('span');
|
||||||
|
icon.className = 'icon-in-input ' + this.options.iconClass;
|
||||||
|
icon.style.color = this.options.getColor();
|
||||||
|
|
||||||
|
const iconClass = this.options.getIconClass();
|
||||||
|
|
||||||
|
if (!iconClass) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
icon.className += ' ' + iconClass;
|
||||||
|
|
||||||
|
const input = view.element.querySelector('.input-group > input');
|
||||||
|
|
||||||
|
if (!input) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
input.after(icon);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -118,6 +118,16 @@ class LayoutFiltersView extends LayoutRowsView {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @type {string[]|null} */
|
||||||
|
const layoutList = model.getFieldParam(name, 'layoutAvailabilityList');
|
||||||
|
|
||||||
|
if (
|
||||||
|
layoutList &&
|
||||||
|
!layoutList.includes(this.type)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !model.getFieldParam(name, 'disabled') &&
|
return !model.getFieldParam(name, 'disabled') &&
|
||||||
!model.getFieldParam(name, 'utility') &&
|
!model.getFieldParam(name, 'utility') &&
|
||||||
!model.getFieldParam(name, 'layoutFiltersDisabled');
|
!model.getFieldParam(name, 'layoutFiltersDisabled');
|
||||||
|
|||||||
@@ -108,8 +108,14 @@ class ExpandedLayoutDashletFieldView extends BaseFieldView {
|
|||||||
|
|
||||||
this.addActionHandler('editItem', (event, target) => this.editItem(target.dataset.name));
|
this.addActionHandler('editItem', (event, target) => this.editItem(target.dataset.name));
|
||||||
|
|
||||||
this.targetEntityType = this.model.get('entityType') ||
|
this.targetEntityType = this.model.attributes.entityType ??
|
||||||
this.getMetadata().get(['dashlets', this.dataObject.dashletName, 'entityType']);
|
this.getMetadata().get(['dashlets', this.dataObject.dashletName, 'entityType']);
|
||||||
|
|
||||||
|
this.listenTo(this.model, 'change:entityType', () => {
|
||||||
|
if (this.model.attributes.entityType) {
|
||||||
|
this.targetEntityType = this.model.attributes.entityType;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -223,8 +223,7 @@ class DetailModalView extends ModalView {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.model = this.sourceModel.clone();
|
this.cloneSourceModel();
|
||||||
this.model.collection = this.sourceModel.collection.clone();
|
|
||||||
|
|
||||||
this.setupAfterModelCreated();
|
this.setupAfterModelCreated();
|
||||||
|
|
||||||
@@ -259,6 +258,23 @@ class DetailModalView extends ModalView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
cloneSourceModel() {
|
||||||
|
this.model = this.sourceModel.clone();
|
||||||
|
|
||||||
|
const sourceCollection = this.sourceModel.collection;
|
||||||
|
|
||||||
|
if (!sourceCollection) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.model.collection = sourceCollection.clone();
|
||||||
|
|
||||||
|
this.listenTo(this.model.collection, 'update-source', () => sourceCollection.fetch())
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Additional setup with the model ready.
|
* Additional setup with the model ready.
|
||||||
*
|
*
|
||||||
@@ -502,7 +518,7 @@ class DetailModalView extends ModalView {
|
|||||||
if (nextButtonEnabled) {
|
if (nextButtonEnabled) {
|
||||||
this.enableButton('next');
|
this.enableButton('next');
|
||||||
} else {
|
} else {
|
||||||
this.disableButton('next');
|
this.disableButton('next');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,6 +528,7 @@ class DetailModalView extends ModalView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const previousModel = this.model;
|
const previousModel = this.model;
|
||||||
|
const previousCollection = this.model.collection;
|
||||||
|
|
||||||
this.sourceModel = this.model.collection.at(indexOfRecord);
|
this.sourceModel = this.model.collection.at(indexOfRecord);
|
||||||
|
|
||||||
@@ -524,12 +541,15 @@ class DetailModalView extends ModalView {
|
|||||||
this.id = this.sourceModel.id;
|
this.id = this.sourceModel.id;
|
||||||
this.scope = this.sourceModel.entityType;
|
this.scope = this.sourceModel.entityType;
|
||||||
|
|
||||||
this.model = this.sourceModel.clone();
|
this.cloneSourceModel();
|
||||||
this.model.collection = this.sourceModel.collection.clone();
|
|
||||||
|
|
||||||
this.stopListening(previousModel, 'change');
|
this.stopListening(previousModel, 'change');
|
||||||
this.stopListening(previousModel, 'sync');
|
this.stopListening(previousModel, 'sync');
|
||||||
|
|
||||||
|
if (previousCollection) {
|
||||||
|
this.stopListening(previousCollection, 'update-source');
|
||||||
|
}
|
||||||
|
|
||||||
this.listenTo(this.model, 'change', () => {
|
this.listenTo(this.model, 'change', () => {
|
||||||
this.sourceModel.set(this.model.getClonedAttributes());
|
this.sourceModel.set(this.model.getClonedAttributes());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -846,7 +846,8 @@ class DetailRecordView extends BaseRecordView {
|
|||||||
if (this.duplicateAction) {
|
if (this.duplicateAction) {
|
||||||
if (
|
if (
|
||||||
this.getAcl().check(this.entityType, 'create') &&
|
this.getAcl().check(this.entityType, 'create') &&
|
||||||
!this.getMetadata().get(['clientDefs', this.scope, 'duplicateDisabled'])
|
!this.getMetadata().get(['clientDefs', this.scope, 'duplicateDisabled']) &&
|
||||||
|
!this.getMetadata().get(['clientDefs', this.scope, 'createDisabled'])
|
||||||
) {
|
) {
|
||||||
this.addDropdownItem({
|
this.addDropdownItem({
|
||||||
label: 'Duplicate',
|
label: 'Duplicate',
|
||||||
|
|||||||
@@ -2364,24 +2364,41 @@ td.cell {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
div:has(.avatar-in-input):not(:has(.being-typed)) {
|
div:has(.avatar-in-input),
|
||||||
> .input-group > input {
|
div:has(.icon-in-input) {
|
||||||
padding-left: var(--33px);
|
&:not(:has(.being-typed)) {
|
||||||
|
> .input-group > input {
|
||||||
|
padding-left: var(--33px);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:has(.color-icon) {
|
||||||
|
> .input-group > input {
|
||||||
|
padding-left: var(--21px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> .icon-in-input,
|
||||||
|
> .avatar-in-input {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 3;
|
||||||
|
user-select: none;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .avatar-in-input {
|
||||||
|
top: var(--9px);
|
||||||
|
left: var(--10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
> .icon-in-input {
|
||||||
|
top: var(--11px);
|
||||||
|
left: var(--10px);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
> .avatar-in-input {
|
> .avatar-in-input,
|
||||||
display: inline-block;
|
> .icon-in-input {
|
||||||
position: absolute;
|
|
||||||
top: var(--9px);
|
|
||||||
left: var(--10px);
|
|
||||||
z-index: 3;
|
|
||||||
user-select: none;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
div:has(.avatar-in-input) {
|
|
||||||
> .avatar-in-input {
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,11 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"additionalParams": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": true,
|
||||||
|
"description": "Additional engine-wise parameters."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -433,6 +433,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"if": {
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"anyOf": [
|
||||||
|
{"const": "enum"},
|
||||||
|
{"const": "multiEnum"},
|
||||||
|
{"const": "checklist"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"then": {
|
||||||
|
"properties": {
|
||||||
|
"isSorted": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Sort the dropdown options alphabetically."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"if": {
|
"if": {
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
Reference in New Issue
Block a user