updated advanced pack to 3.12.0:
Reports:
Non-aggregated columns in Grid report export.
Normalized table mode for 2-dimensional Grid reports.
Ability to create internal reports via the UI.
Ability to show/hide and resize columns in the list report result view.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
* usage to the software or any modified version or derivative work of the software
|
||||
* created by or for you.
|
||||
*
|
||||
* Copyright (C) 2015-2025 EspoCRM, Inc.
|
||||
* Copyright (C) 2015-2026 EspoCRM, Inc.
|
||||
*
|
||||
* License ID: 19bc86a68a7bb01f458cb391d43a9212
|
||||
************************************************************************************/
|
||||
@@ -35,6 +35,7 @@ use Espo\Entities\Job;
|
||||
use Espo\Entities\User;
|
||||
use Espo\Modules\Advanced\Business\Report\EmailBuilder;
|
||||
use Espo\Modules\Advanced\Entities\Report as ReportEntity;
|
||||
use Espo\Modules\Advanced\Tools\Report\Export\GridExportService;
|
||||
use Espo\Modules\Advanced\Tools\Report\GridType\Result as GridResult;
|
||||
use Espo\Modules\Advanced\Tools\Report\Jobs\Send;
|
||||
use Espo\Modules\Advanced\Tools\Report\ListType\Result as ListResult;
|
||||
@@ -60,7 +61,8 @@ class SendingService
|
||||
private Config $config,
|
||||
private FieldUtil $fieldUtil,
|
||||
private InjectableFactory $injectableFactory,
|
||||
private EmailBuilder $emailBuilder
|
||||
private EmailBuilder $emailBuilder,
|
||||
private ListExportService $listExportService,
|
||||
) {}
|
||||
|
||||
private function getSendingListMaxCount(): int
|
||||
@@ -218,25 +220,19 @@ class SendingService
|
||||
throw new RuntimeException("Bad result.");
|
||||
}
|
||||
|
||||
if (!$entityType) {
|
||||
throw new RuntimeException("No entity type.");
|
||||
}
|
||||
|
||||
$fieldList = $report->getColumns();
|
||||
|
||||
foreach ($fieldList as $key => $field) {
|
||||
if (strpos($field, '.')) {
|
||||
$fieldList[$key] = str_replace('.', '_', $field);
|
||||
foreach ($fieldList as $i => $field) {
|
||||
if (str_contains($field, '.')) {
|
||||
$fieldList[$i] = str_replace('.', '_', $field);
|
||||
}
|
||||
}
|
||||
|
||||
$attributeList = [];
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
$fieldAttributeList = $this->fieldUtil->getAttributeList($report->getTargetEntityType(), $field);
|
||||
|
||||
if (count($fieldAttributeList) > 0) {
|
||||
$attributeList = array_merge($attributeList, $fieldAttributeList);
|
||||
} else {
|
||||
$attributeList[] = $field;
|
||||
}
|
||||
}
|
||||
$attributeList = $this->prepareListAttributeList($fieldList, $report, $entityType);
|
||||
|
||||
$exportParams = ExportToolParams::create($entityType)
|
||||
->withFieldList($fieldList)
|
||||
@@ -432,4 +428,27 @@ class SendingService
|
||||
{
|
||||
$this->emailBuilder->buildEmailData($data, $result, $report, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $fieldList
|
||||
* @return string[]
|
||||
*/
|
||||
private function prepareListAttributeList(array $fieldList, ReportEntity $report, ?string $entityType): array
|
||||
{
|
||||
$attributeList = [];
|
||||
|
||||
foreach ($fieldList as $field) {
|
||||
if (str_contains($field, '_')) {
|
||||
$attributeList[] = $field;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$itAttributeList = $this->fieldUtil->getAttributeList($report->getTargetEntityType(), $field);
|
||||
|
||||
$attributeList = array_merge($attributeList, $itAttributeList);
|
||||
}
|
||||
|
||||
return $this->listExportService->prepareAttributeList($entityType, $attributeList);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user