Add AdvowareAkte and AIKnowledge creation for Kündigungen; synchronize between Kündigungen and Räumungsklagen; update localization and metadata files
This commit is contained in:
@@ -12,21 +12,20 @@ use Espo\Core\Utils\File\Manager as FileManager;
|
||||
*/
|
||||
class CDokumente extends Record
|
||||
{
|
||||
private FileStorageManager $fileStorageManager;
|
||||
private FileManager $fileManager;
|
||||
|
||||
/**
|
||||
* Inject additional dependencies via setter methods
|
||||
* EspoCRM DI will automatically call these
|
||||
* Get FileStorageManager from container on-demand
|
||||
*/
|
||||
public function injectFileStorageManager(FileStorageManager $fileStorageManager): void
|
||||
private function getFileStorageManager(): FileStorageManager
|
||||
{
|
||||
$this->fileStorageManager = $fileStorageManager;
|
||||
return $this->injectableFactory->create(FileStorageManager::class);
|
||||
}
|
||||
|
||||
public function injectFileManager(FileManager $fileManager): void
|
||||
/**
|
||||
* Get FileManager from container on-demand
|
||||
*/
|
||||
private function getFileManager(): FileManager
|
||||
{
|
||||
$this->fileManager = $fileManager;
|
||||
return $this->injectableFactory->create(FileManager::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,14 +119,14 @@ class CDokumente extends Record
|
||||
private function duplicateAttachment(Entity $sourceAttachment): Entity
|
||||
{
|
||||
// 1. Get source file path
|
||||
$sourceFilePath = $this->fileStorageManager->getLocalFilePath($sourceAttachment);
|
||||
$sourceFilePath = $this->getFileStorageManager()->getLocalFilePath($sourceAttachment);
|
||||
|
||||
if (!file_exists($sourceFilePath)) {
|
||||
throw new \RuntimeException('Source file not found: ' . $sourceFilePath);
|
||||
}
|
||||
|
||||
// 2. Read source file content
|
||||
$fileContent = $this->fileManager->getContents($sourceFilePath);
|
||||
$fileContent = $this->getFileManager()->getContents($sourceFilePath);
|
||||
|
||||
// 3. Create new attachment entity
|
||||
$newAttachment = $this->entityManager->getEntity('Attachment');
|
||||
@@ -142,7 +141,7 @@ class CDokumente extends Record
|
||||
$this->entityManager->saveEntity($newAttachment);
|
||||
|
||||
// 4. Write file content to new location
|
||||
$this->fileStorageManager->putContents($newAttachment, $fileContent);
|
||||
$this->getFileStorageManager()->putContents($newAttachment, $fileContent);
|
||||
|
||||
// 5. Return new attachment
|
||||
return $newAttachment;
|
||||
|
||||
Reference in New Issue
Block a user