EspoCRM – Open Source CRM Application
PHP calendarcontactscrmcrm-platformcrm-systemcustomer-portalcustomer-supportcustomizabledocumentsemail-marketingkanbanleadsopen-sourcephpplatformsales-automationsingle-page-applicationsupport
getRecordsPerPage
Yuri Kuznetsovee38f09665f8
diff --git a/application/Espo/Core/Utils/Config/ApplicationConfig.php b/application/Espo/Core/Utils/Config/ApplicationConfig.phpindex da8cfdbed0..2a63458f37 100644--- a/application/Espo/Core/Utils/Config/ApplicationConfig.php+++ b/application/Espo/Core/Utils/Config/ApplicationConfig.php@@ -64,4 +64,12 @@ class ApplicationConfig{return $this->config->get('language') ?? 'en_US';}++ /**+ * @since 9.2.0+ */+ public function getRecordsPerPage(): int+ {+ return (int) $this->config->get('recordsPerPage');+ }}diff --git a/application/Espo/Tools/EmailAddress/Api/GetSearch.php b/application/Espo/Tools/EmailAddress/Api/GetSearch.phpindex 7e9100de81..8681dd7721 100644--- a/application/Espo/Tools/EmailAddress/Api/GetSearch.php+++ b/application/Espo/Tools/EmailAddress/Api/GetSearch.php@@ -42,6 +42,7 @@ use Espo\Tools\Email\AddressService;/*** Searches email addresses.+ * @noinspection PhpUnused*/class GetSearch implements Action{@@ -50,7 +51,7 @@ class GetSearch implements Actionpublic function __construct(private AddressService $service,private Acl $acl,- private Config $config+ private Config\ApplicationConfig $applicationConfig,) {}public function process(Request $request): Response@@ -81,7 +82,7 @@ class GetSearch implements Action}if (!$maxSize || $maxSize > self::ADDRESS_MAX_SIZE) {- $maxSize = (int) $this->config->get('recordsPerPage');+ $maxSize = $this->applicationConfig->getRecordsPerPage();}if ($entityType) {diff --git a/application/Espo/Tools/GlobalSearch/Service.php b/application/Espo/Tools/GlobalSearch/Service.phpindex 240bb0b702..8a6706a003 100644--- a/application/Espo/Tools/GlobalSearch/Service.php+++ b/application/Espo/Tools/GlobalSearch/Service.php@@ -55,7 +55,8 @@ class Serviceprivate EntityManager $entityManager,private Metadata $metadata,private Acl $acl,- private Config $config+ private Config $config,+ private Config\ApplicationConfig $applicationConfig,) {}/**@@ -67,7 +68,7 @@ class Servicepublic function find(string $filter, int $offset = 0, ?int $maxSize = null): Collection{$entityTypeList = $this->config->get('globalSearchEntityList') ?? [];- $maxSize ??= (int) $this->config->get('recordsPerPage');+ $maxSize ??= $this->applicationConfig->getRecordsPerPage();$hasFullTextSearch = false;