chore: Update copyright year from 2025 to 2026 across core files

- Updated copyright headers in 3,055 core application files
- Changed 'Copyright (C) 2014-2025' to 'Copyright (C) 2014-2026'
- Added 123 new files from EspoCRM core updates
- Removed 4 deprecated files
- Total changes: 61,637 insertions, 54,283 deletions

This is a routine maintenance update for the new year 2026.
This commit is contained in:
2026-02-07 16:05:21 +01:00
parent 6a8a4a2882
commit 127fa6503b
6468 changed files with 564781 additions and 31179 deletions

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -0,0 +1,53 @@
<?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\Tools\App\Api;
use Espo\Core\Api\Action;
use Espo\Core\Api\Request;
use Espo\Core\Api\Response;
use Espo\Core\Api\ResponseComposer;
use Espo\Tools\App\AppService;
/**
* @noinspection PhpUnused
*/
class GetAppParams implements Action
{
public function __construct(
private AppService $appService,
) {}
public function process(Request $request): Response
{
$data = $this->appService->getAppParams();
return ResponseComposer::json($data);
}
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -149,10 +149,7 @@ class AppService
];
}
/**
* @return array<string, mixed>
*/
private function getAppParams(): array
public function getAppParams(): stdClass
{
$user = $this->user;
@@ -205,7 +202,7 @@ class AppService
$appParams[$paramKey] = $itemParams;
}
return $appParams;
return (object) $appParams;
}
private function getUserDataForFrontend(): stdClass

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -248,6 +248,10 @@ class LanguageService
}
}
if (!str_contains($target, '.')) {
$this->restoreEntityType($data, $languageObj, $target);
}
$pointer =& $data;
foreach ($targetArr as $i => $k) {
@@ -269,4 +273,17 @@ class LanguageService
}
}
}
/**
* @param array<string, mixed> $data
*/
private function restoreEntityType(&$data, LanguageUtil $languageObj, string $target): void
{
$data['Global'] ??= [];
$data['Global']['scopeNames'] ??= [];
$data['Global']['scopeNamesPlural'] ??= [];
$data['Global']['scopeNames'][$target] = $languageObj->translateLabel($target, 'scopeNames');
$data['Global']['scopeNamesPlural'][$target] = $languageObj->translateLabel($target, 'scopeNamesPlural');
}
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -43,6 +43,7 @@ use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\FieldValidation\FieldValidationManager;
use Espo\Core\Utils\Config;
use Espo\Core\Utils\Metadata;
use stdClass;
@@ -53,19 +54,22 @@ class PreferencesService
private Acl $acl;
private Config $config;
private FieldValidationManager $fieldValidationManager;
private Metadata $metadata;
public function __construct(
EntityManager $entityManager,
User $user,
Acl $acl,
Config $config,
FieldValidationManager $fieldValidationManager
FieldValidationManager $fieldValidationManager,
Metadata $metadata
) {
$this->entityManager = $entityManager;
$this->user = $user;
$this->acl = $acl;
$this->config = $config;
$this->fieldValidationManager = $fieldValidationManager;
$this->metadata = $metadata;
}
/**
@@ -209,7 +213,16 @@ class PreferencesService
}
$dashboardLayout = $this->config->get('dashboardLayout');
$dashletsOptions = $this->config->get('dashletsOptions');
$dashletsOptions = null;
if (!$dashboardLayout) {
$dashboardLayout = $this->metadata->get('app.defaultDashboardLayouts.Standard');
$dashletsOptions = $this->metadata->get('app.defaultDashboardOptions.Standard');
}
if ($dashletsOptions === null) {
$dashletsOptions = $this->config->get('dashletsOptions');
}
$preferences->set([
'dashboardLayout' => $dashboardLayout,

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -35,7 +35,6 @@ use Espo\Entities\Email;
use Espo\Entities\Settings;
use Espo\ORM\Entity;
use Espo\ORM\EntityManager;
use Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\Forbidden;
@@ -50,10 +49,9 @@ use Espo\Core\Utils\Metadata;
use Espo\Core\Utils\Config;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\Core\Utils\Config\Access;
use Espo\Entities\Portal;
use Espo\Repositories\Portal as PortalRepository;
use Espo\Tools\Currency\SyncManager as CurrencySyncManager;
use stdClass;
class SettingsService
@@ -74,6 +72,8 @@ class SettingsService
private Config\SystemConfig $systemConfig,
private EmailConfigDataProvider $emailConfigDataProvider,
private Acl\Cache\Clearer $aclCacheClearer,
private CurrencySyncManager $currencySyncManager,
private CurrencyDatabasePopulator $currencyDatabasePopulator,
) {}
/**
@@ -243,8 +243,9 @@ class SettingsService
$this->aclCacheClearer->clearForAllInternalUsers();
}
if (isset($data->defaultCurrency) || isset($data->baseCurrency) || isset($data->currencyRates)) {
$this->populateDatabaseWithCurrencyRates();
if (isset($data->baseCurrency) || isset($data->currencyList) || isset($data->defaultCurrency)) {
$this->currencySyncManager->sync();
$this->currencyDatabasePopulator->process();
}
}
@@ -340,11 +341,6 @@ class SettingsService
}
}
private function populateDatabaseWithCurrencyRates(): void
{
$this->injectableFactory->create(CurrencyDatabasePopulator::class)->process();
}
private function filterData(stdClass $data): void
{
$user = $this->applicationState->getUser();

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -66,6 +66,7 @@ class UploadUrlService
/**
* Upload an image from and URL and store as attachment.
*
* @param non-empty-string $url
* @throws Forbidden
* @throws Error
*/
@@ -111,7 +112,7 @@ class UploadUrlService
}
/**
* @param string $url
* @param non-empty-string $url
* @return ?array{string, string} A type and contents.
*/
private function getImageDataByUrl(string $url): ?array
@@ -127,7 +128,7 @@ class UploadUrlService
$httpHeaders = [];
$httpHeaders[] = 'Expect:';
$opts[\CURLOPT_URL] = $url;
$opts[\CURLOPT_URL] = $url;
$opts[\CURLOPT_HTTPHEADER] = $httpHeaders;
$opts[\CURLOPT_CONNECTTIMEOUT] = 10;
$opts[\CURLOPT_TIMEOUT] = 10;

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -80,12 +80,20 @@ class Checker
$response = curl_exec($ch);
curl_close($ch);
if (!is_string($response)) {
throw new RuntimeException("Bad CURL response.");
$message = "CURL failure.";
$curlError = curl_error($ch);
if ($curlError) {
$message .= " " . $curlError;
}
throw new RuntimeException($message);
}
curl_close($ch);
$responseData = Json::decode($response, true);
if (!is_array($responseData)) {

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -30,6 +30,8 @@
namespace Espo\Tools\Currency\Conversion;
use Espo\Core\Currency\Rates;
use Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\Conflict;
use Espo\Core\Exceptions\Forbidden;
use Espo\ORM\Entity;
@@ -43,6 +45,8 @@ interface EntityConverter
/**
* @param TEntity $entity
* @throws Forbidden
* @throws BadRequest
* @throws Conflict
*/
public function convert(Entity $entity, string $targetCurrency, Rates $rates): void;
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -0,0 +1,35 @@
<?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\Tools\Currency\Exceptions;
use Exception;
class NotEnabled extends Exception
{}

View File

@@ -0,0 +1,184 @@
<?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\Tools\Currency;
use Espo\Core\Currency\ConfigDataProvider;
use Espo\Core\Currency\InternalRateEntryProvider;
use Espo\Core\Field\Date;
use Espo\Core\Utils\DateTime;
use Espo\Entities\CurrencyRecord;
use Espo\Entities\CurrencyRecordRate;
use Espo\ORM\EntityManager;
use Espo\ORM\Query\Part\Order;
use Espo\Tools\Currency\Exceptions\NotEnabled;
use WeakMap;
/**
* @since 9.3.0
*/
class RateEntryProvider
{
/** @var WeakMap<CurrencyRecord, ?CurrencyRecordRate> */
private WeakMap $map;
public function __construct(
private ConfigDataProvider $configDataProvider,
private EntityManager $entityManager,
private DateTime $dateTime,
private InternalRateEntryProvider $internalRateEntryProvider,
) {
$this->map = new WeakMap();
}
public function getCurrentRateEntry(CurrencyRecord $record): ?CurrencyRecordRate
{
if (!$this->map->offsetExists($record)) {
$this->map[$record] = $this->entityManager
->getRDBRepositoryByClass(CurrencyRecordRate::class)
->where([
CurrencyRecordRate::ATTR_RECORD_ID => $record->getId(),
CurrencyRecordRate::FIELD_BASE_CODE => $this->configDataProvider->getBaseCurrency(),
CurrencyRecordRate::FIELD_DATE . '<=' => $this->dateTime->getToday()->toString(),
])
->order(CurrencyRecordRate::FIELD_DATE, Order::DESC)
->findOne();
}
return $this->map[$record];
}
/**
* @throws NotEnabled
*/
public function prepareNew(string $code, Date $date): CurrencyRecordRate
{
$record = $this->getRecordByCode($code);
$entry = $this->entityManager->getRDBRepositoryByClass(CurrencyRecordRate::class)->getNew();
$entry
->setRecord($record)
->setDate($date);
return $entry;
}
private function getRateEntryForRecord(CurrencyRecord $record, ?Date $date = null): ?CurrencyRecordRate
{
$date ??= $this->dateTime->getToday();
$base = $this->configDataProvider->getBaseCurrency();
return $this->internalRateEntryProvider->getRateEntryForRecord($record, $date, $base);
}
/**
* Get rate against the base currency by a record.
*
* @return ?numeric-string
*/
public function getRateForRecord(CurrencyRecord $record, ?Date $date = null): ?string
{
$rateEntry = $this->getRateEntryForRecord($record, $date);
return $rateEntry?->getRate();
}
/**
* Get rate against the base currency.
*
* @param string $code
* @return ?numeric-string
* @throws NotEnabled
*/
public function getRate(string $code): ?string
{
$record = $this->getRecordByCode($code);
return $this->getRateForRecord($record);
}
/**
* @throws NotEnabled
*/
public function getRateEntryOnDate(string $code, Date $date): ?CurrencyRecordRate
{
$record = $this->getRecordByCode($code);
return $this->entityManager
->getRDBRepositoryByClass(CurrencyRecordRate::class)
->where([
CurrencyRecordRate::ATTR_RECORD_ID => $record->getId(),
CurrencyRecordRate::FIELD_BASE_CODE => $this->configDataProvider->getBaseCurrency(),
CurrencyRecordRate::FIELD_DATE => $date->toString(),
])
->order(CurrencyRecordRate::FIELD_DATE, Order::DESC)
->findOne();
}
/**
* @since 9.3.0
* @throws NotEnabled
* @noinspection PhpUnused
*/
public function getRateEntryOnAsOfDate(string $code, Date $date): ?CurrencyRecordRate
{
$record = $this->getRecordByCode($code);
return $this->entityManager
->getRDBRepositoryByClass(CurrencyRecordRate::class)
->where([
CurrencyRecordRate::ATTR_RECORD_ID => $record->getId(),
CurrencyRecordRate::FIELD_BASE_CODE => $this->configDataProvider->getBaseCurrency(),
CurrencyRecordRate::FIELD_DATE . '<=' => $date->toString(),
])
->order(CurrencyRecordRate::FIELD_DATE, Order::DESC)
->findOne();
}
/**
* @throws NotEnabled
*/
private function getRecordByCode(string $code): CurrencyRecord
{
$record = $this->entityManager
->getRDBRepositoryByClass(CurrencyRecord::class)
->where([
CurrencyRecord::FIELD_CODE => $code,
CurrencyRecord::FIELD_STATUS => CurrencyRecord::STATUS_ACTIVE,
])
->findOne();
if (!$record) {
throw new NotEnabled("Currency $code is not enabled.");
}
return $record;
}
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -35,18 +35,23 @@ use Espo\Core\Currency\Rates;
use Espo\Core\Exceptions\BadRequest;
use Espo\Core\Exceptions\Forbidden;
use Espo\Core\Acl;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\Core\Utils\Currency\DatabasePopulator;
use Espo\Core\Utils\DateTime;
use Espo\ORM\EntityManager;
use RuntimeException;
class RateService
{
private const SCOPE = 'Currency';
private const string SCOPE = 'Currency';
public function __construct(
private ConfigWriter $configWriter,
private Acl $acl,
private DatabasePopulator $databasePopulator,
private ConfigDataProvider $configDataProvider
private ConfigDataProvider $configDataProvider,
private SyncManager $syncManager,
private RateEntryProvider $rateEntryProvider,
private DateTime $dateTime,
private EntityManager $entityManager,
) {}
/**
@@ -54,13 +59,7 @@ class RateService
*/
public function get(): Rates
{
if (!$this->acl->check(self::SCOPE)) {
throw new Forbidden();
}
if ($this->acl->getLevel(self::SCOPE, Table::ACTION_READ) !== Table::LEVEL_YES) {
throw new Forbidden();
}
$this->checkReadAccess();
$rates = Rates::create($this->configDataProvider->getBaseCurrency());
@@ -76,6 +75,62 @@ class RateService
* @throws Forbidden
*/
public function set(Rates $rates): void
{
$this->checkEditAccess();
$codeList = $this->configDataProvider->getCurrencyList();
$base = $this->configDataProvider->getBaseCurrency();
foreach ($rates->toAssoc() as $code => $value) {
if ($value < 0) {
throw new BadRequest("Bad value.");
}
if (!in_array($code, $codeList) || $code === $base) {
continue;
}
$this->writeOne($code, $value);
}
$this->syncManager->refreshCache();
$this->databasePopulator->process();
}
private function writeOne(string $code, float $value): void
{
$date = $this->dateTime->getToday();
try {
$rateEntry = $this->rateEntryProvider->getRateEntryOnDate($code, $date) ??
$this->rateEntryProvider->prepareNew($code, $date);
} catch (Exceptions\NotEnabled $e) {
throw new RuntimeException($e->getMessage(), previous: $e);
}
$rateEntry->setRate((string) $value);
$this->entityManager->saveEntity($rateEntry);
}
/**
* @throws Forbidden
*/
private function checkReadAccess(): void
{
if (!$this->acl->check(self::SCOPE)) {
throw new Forbidden();
}
if ($this->acl->getLevel(self::SCOPE, Table::ACTION_READ) !== Table::LEVEL_YES) {
throw new Forbidden();
}
}
/**
* @throws Forbidden
*/
private function checkEditAccess(): void
{
if (!$this->acl->check(self::SCOPE)) {
throw new Forbidden();
@@ -84,39 +139,5 @@ class RateService
if ($this->acl->getLevel(self::SCOPE, Table::ACTION_EDIT) !== Table::LEVEL_YES) {
throw new Forbidden();
}
$currencyList = $this->configDataProvider->getCurrencyList();
$baseCurrency = $this->configDataProvider->getBaseCurrency();
$set = [];
foreach ($rates->toAssoc() as $key => $value) {
if ($value < 0) {
throw new BadRequest("Bad value.");
}
if (!in_array($key, $currencyList)) {
continue;
}
if ($key === $baseCurrency) {
continue;
}
$set[$key] = $value;
}
foreach ($currencyList as $currency) {
if ($currency === $baseCurrency) {
continue;
}
$set[$currency] ??= $this->configDataProvider->getCurrencyRate($currency);
}
$this->configWriter->set('currencyRates', $set);
$this->configWriter->save();
$this->databasePopulator->process();
}
}

View File

@@ -0,0 +1,166 @@
<?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\Tools\Currency;
use Espo\Core\Currency\ConfigDataProvider;
use Espo\Core\Utils\Config\ConfigWriter;
use Espo\Core\Utils\Config\SystemConfig;
use Espo\Core\Utils\DataCache;
use Espo\Entities\CurrencyRecord;
use Espo\ORM\EntityManager;
use Espo\ORM\Query\UpdateBuilder;
use Espo\Tools\Currency\Exceptions\NotEnabled;
/**
* @since 9.3.0
* @internal
*/
class SyncManager
{
private string $cacheKey = 'currencyRates';
public function __construct(
private ConfigDataProvider $configDataProvider,
private EntityManager $entityManager,
private ConfigWriter $configWriter,
private RateEntryProvider $rateEntryProvider,
private DataCache $dataCache,
private SystemConfig $systemConfig,
) {}
public function sync(): void
{
$this->entityManager->getTransactionManager()->run(function () {
$this->syncInTransaction();
});
$this->refreshCache();
}
private function syncInTransaction(): void
{
$this->lock();
foreach ($this->configDataProvider->getCurrencyList() as $code) {
$this->syncCode($code);
}
$this->deactivateNotListed();
}
private function syncCode(string $code): void
{
$record = $this->entityManager
->getRDBRepositoryByClass(CurrencyRecord::class)
->where([CurrencyRecord::FIELD_CODE => $code])
->findOne();
if (!$record) {
$record = $this->entityManager->getRDBRepositoryByClass(CurrencyRecord::class)->getNew();
$record->setCode($code);
}
$record->setStatus(CurrencyRecord::STATUS_ACTIVE);
$this->entityManager->saveEntity($record);
}
private function deactivateNotListed(): void
{
$list = $this->configDataProvider->getCurrencyList();
$updateQuery = UpdateBuilder::create()
->in(CurrencyRecord::ENTITY_TYPE)
->set([
CurrencyRecord::FIELD_STATUS => CurrencyRecord::STATUS_INACTIVE,
])
->where([
CurrencyRecord::FIELD_CODE . '!=' => $list,
])
->build();
$this->entityManager->getQueryExecutor()->execute($updateQuery);
}
private function lock(): void
{
$this->entityManager
->getRDBRepositoryByClass(CurrencyRecord::class)
->forUpdate()
->sth()
->find();
}
public function refreshCache(): void
{
$this->entityManager->getTransactionManager()->run(function () {
$this->syncToConfigInTransaction();
});
$this->clearCache();
}
private function syncToConfigInTransaction(): void
{
$this->lock();
$rates = $this->configDataProvider->getCurrencyRates()->toAssoc();
$this->configWriter->set('currencyRates', $rates);
$this->configWriter->save();
}
/**
* @throws NotEnabled
*/
public function updateCode(string $code): void
{
$rates = $this->configDataProvider->getCurrencyRates()->toAssoc();
$rate = $this->rateEntryProvider->getRate($code) ?? '1.0';
$rates[$code] = (float) $rate;
$this->configWriter->set('currencyRates', $rates);
$this->configWriter->save();
$this->clearCache();
}
private function clearCache(): void
{
if (!$this->systemConfig->useCache()) {
return;
}
$this->dataCache->clear($this->cacheKey);
}
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -36,11 +36,15 @@ use Espo\Core\Exceptions\NotFound;
use Espo\Core\FieldProcessing\EmailAddress\AccessChecker as EmailAddressAccessChecker;
use Espo\Core\FieldProcessing\PhoneNumber\AccessChecker as PhoneNumberAccessChecker;
use Espo\Core\Name\Field;
use Espo\Core\Name\Link;
use Espo\Core\ORM\Type\FieldType;
use Espo\Core\Record\ServiceContainer as RecordServiceContainer;
use Espo\Core\Di;
use Espo\Entities\Attachment;
use Espo\Entities\EmailAddress;
use Espo\Entities\PhoneNumber;
use Traversable;
class Erasor implements
@@ -63,7 +67,7 @@ class Erasor implements
public function __construct(
private RecordServiceContainer $recordServiceContainer,
private EmailAddressAccessChecker $emailAddressAccessChecker,
private PhoneNumberAccessChecker $phoneNumberAccessChecker
private PhoneNumberAccessChecker $phoneNumberAccessChecker,
) {}
/**
@@ -107,15 +111,18 @@ class Erasor implements
$attributeList = $fieldUtil->getActualAttributeList($entityType, $field);
if ($type === FieldType::EMAIL) {
$emailAddressList = $entity->get('emailAddresses');
/** @var Traversable<int, EmailAddress> $emailAddresses */
$emailAddresses = $this->entityManager
->getRelation($entity, Link::EMAIL_ADDRESSES)
->find();
foreach ($emailAddressList as $emailAddress) {
foreach ($emailAddresses as $emailAddress) {
if (
$this->emailAddressAccessChecker
->checkEdit($this->user, $emailAddress, $entity)
$this->emailAddressAccessChecker->checkEdit($this->user, $emailAddress, $entity)
) {
$emailAddress->set(Field::NAME, 'ERASED:' . $emailAddress->getId());
$emailAddress->set('optOut', true);
$emailAddress->setOptedOut(true);
$this->entityManager->saveEntity($emailAddress);
}
}
@@ -124,15 +131,20 @@ class Erasor implements
$entity->clear($field . 'Data');
continue;
} else if ($type === FieldType::PHONE) {
$phoneNumberList = $entity->get('phoneNumbers');
}
foreach ($phoneNumberList as $phoneNumber) {
if ($type === FieldType::PHONE) {
/** @var Traversable<int, PhoneNumber> $phoneNumbers */
$phoneNumbers = $this->entityManager
->getRelation($entity, Link::PHONE_NUMBERS)
->find();
foreach ($phoneNumbers as $phoneNumber) {
if (
$this->phoneNumberAccessChecker
->checkEdit($this->user, $phoneNumber, $entity)
$this->phoneNumberAccessChecker->checkEdit($this->user, $phoneNumber, $entity)
) {
$phoneNumber->set(Field::NAME, 'ERASED:' . $phoneNumber->getId());
$phoneNumber->setOptedOut(true);
$this->entityManager->saveEntity($phoneNumber);
}
@@ -142,7 +154,9 @@ class Erasor implements
$entity->clear($field . 'Data');
continue;
} else if ($type === FieldType::FILE || $type === FieldType::IMAGE) {
}
if ($type === FieldType::FILE || $type === FieldType::IMAGE) {
$attachmentId = $entity->get($field . 'Id');
if ($attachmentId) {

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -29,6 +29,7 @@
namespace Espo\Tools\DynamicLogic;
use Espo\Core\Currency\CalculatorUtil;
use Espo\Core\Field\Date;
use Espo\Core\Field\DateTime;
use Espo\Core\Utils\DateTime\SystemClock;
@@ -214,18 +215,50 @@ class ConditionChecker
}
if ($type === Type::GreaterThan) {
if (is_string($setValue) || is_string($value)) {
if (!(is_string($setValue) && is_string($value))) {
return false;
}
return $this->compare($setValue, $value) > 0;
}
return $setValue > $value;
}
if ($type === Type::LessThan) {
if (is_string($setValue) || is_string($value)) {
if (!(is_string($setValue) && is_string($value))) {
return false;
}
return $this->compare($setValue, $value) < 0;
}
return $setValue < $value;
}
if ($type === Type::GreaterThanOrEquals) {
if (is_string($setValue) || is_string($value)) {
if (!(is_string($setValue) && is_string($value))) {
return false;
}
return $this->compare($setValue, $value) >= 0;
}
return $setValue >= $value;
}
if ($type === Type::LessThanOrEquals) {
if (is_string($setValue) || is_string($value)) {
if (!(is_string($setValue) && is_string($value))) {
return false;
}
return $this->compare($setValue, $value) <= 0;
}
return $setValue <= $value;
}
@@ -346,4 +379,20 @@ class ConditionChecker
return Date::fromDateTime($dateTime);
}
/**
* @throws BadCondition
*/
private function compare(mixed $arg1, mixed $arg2): int
{
$arg1 = (string) $arg1;
$arg2 = (string) $arg2;
if (!is_numeric($arg1) || !is_numeric($arg2)) {
throw new BadCondition();
}
return CalculatorUtil::compare($arg1, $arg2);
}
}

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify
@@ -33,6 +33,7 @@ use Espo\Core\Exceptions\Conflict;
use Espo\Core\Exceptions\Error;
use Espo\Core\Exceptions\NotFound;
use Espo\Core\FileStorage\Manager;
use Espo\Core\Mail\Exceptions\ImapError;
use Espo\Core\Mail\Importer;
use Espo\Core\Mail\Importer\Data;
use Espo\Core\Mail\MessageWrapper;
@@ -40,6 +41,7 @@ use Espo\Core\Mail\Parsers\MailMimeParser;
use Espo\Entities\Attachment;
use Espo\Entities\Email;
use Espo\ORM\EntityManager;
use RuntimeException;
class ImportEmlService
{
@@ -66,7 +68,11 @@ class ImportEmlService
$attachment = $this->getAttachment($fileId);
$contents = $this->fileStorageManager->getContents($attachment);
$message = new MessageWrapper(1, null, $this->parser, $contents);
try {
$message = new MessageWrapper(1, null, $this->parser, $contents);
} catch (ImapError $e) {
throw new RuntimeException(previous: $e);
}
$this->checkDuplicate($message);

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

View File

@@ -3,7 +3,7 @@
* This file is part of EspoCRM.
*
* EspoCRM Open Source CRM application.
* Copyright (C) 2014-2025 EspoCRM, Inc.
* Copyright (C) 2014-2026 EspoCRM, Inc.
* Website: https://www.espocrm.com
*
* This program is free software: you can redistribute it and/or modify

Some files were not shown because too many files have changed in this diff Show More