mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
fixes
This commit is contained in:
@@ -68,7 +68,7 @@ class PrinterController
|
||||
$params = $params ?? new Params();
|
||||
$data = $data ?? new Data();
|
||||
|
||||
return $this->createPrinter('entity')->print($this->template, $entity, $params, $data);
|
||||
return $this->createEntityPrinter()->print($this->template, $entity, $params, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,17 +79,30 @@ class PrinterController
|
||||
$params = $params ?? new Params();
|
||||
$IdDataMap = $IdDataMap ?? new IdDataMap();
|
||||
|
||||
return $this->createPrinter('collection')->print($this->template, $collection, $params, $IdDataMap);
|
||||
return $this->createCollectionPrinter()->print($this->template, $collection, $params, $IdDataMap);
|
||||
}
|
||||
|
||||
private function createPrinter(string $type): object
|
||||
private function createEntityPrinter(): EntityPrinter
|
||||
{
|
||||
/** @var ?class-string */
|
||||
$className = $this->metadata
|
||||
->get(['app', 'pdfEngines', $this->engine, 'implementationClassNameMap', $type]) ?? null;
|
||||
->get(['app', 'pdfEngines', $this->engine, 'implementationClassNameMap', 'entity']) ?? null;
|
||||
|
||||
if (!$className) {
|
||||
throw new Error("Unknown PDF engine '{$this->engine}', type '{$type}'.");
|
||||
throw new Error("Unknown PDF engine '{$this->engine}', type 'entity'.");
|
||||
}
|
||||
|
||||
return $this->injectableFactory->create($className);
|
||||
}
|
||||
|
||||
private function createCollectionPrinter(): CollectionPrinter
|
||||
{
|
||||
/** @var ?class-string */
|
||||
$className = $this->metadata
|
||||
->get(['app', 'pdfEngines', $this->engine, 'implementationClassNameMap', 'collection']) ?? null;
|
||||
|
||||
if (!$className) {
|
||||
throw new Error("Unknown PDF engine '{$this->engine}', type 'collection'.");
|
||||
}
|
||||
|
||||
return $this->injectableFactory->create($className);
|
||||
|
||||
@@ -550,14 +550,18 @@ class HookProcessor
|
||||
if (is_null($this->statusFields)) {
|
||||
$this->statusFields = [];
|
||||
|
||||
/** @var array<string,array<string,mixed>> */
|
||||
$scopes = $this->metadata->get('scopes', []);
|
||||
|
||||
foreach ($scopes as $scope => $data) {
|
||||
if (empty($data['statusField'])) {
|
||||
/** @var ?string */
|
||||
$statusField = $data['statusField'] ?? null;
|
||||
|
||||
if (!$statusField) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->statusFields[$scope] = $data['statusField'];
|
||||
$this->statusFields[$scope] = $statusField;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user