This commit is contained in:
Yuri Kuznetsov
2025-06-30 17:00:01 +03:00
parent c4967c774c
commit 0a7fe37014
3 changed files with 14 additions and 20 deletions
@@ -103,8 +103,7 @@ class Process implements Job
private function notifyFinish(MassActionEntity $entity): void
{
/** @var Notification $notification */
$notification = $this->entityManager->getNewEntity(Notification::ENTITY_TYPE);
$notification = $this->entityManager->getRDBRepositoryByClass(Notification::class)->getNew();
$message = $this->language->translateLabel('massActionProcessed', 'messages');
+1 -1
View File
@@ -146,7 +146,7 @@ class Note extends Entity
public function isAclProcessed(): bool
{
return (bool) $this->aclIsProcessed;
return $this->aclIsProcessed;
}
public function loadAttachments(): void
+12 -17
View File
@@ -30,17 +30,13 @@
namespace Espo\Tools\Export\Jobs;
use Espo\Core\Exceptions\Error;
use Espo\Core\Job\Job;
use Espo\Core\Job\Job\Data as JobData;
use Espo\Tools\Export\Factory;
use Espo\Tools\Export\Result;
use Espo\Core\Utils\Language;
use Espo\ORM\EntityManager;
use Espo\Entities\Export as ExportEntity;
use Espo\Entities\Export;
use Espo\Entities\Notification;
use Espo\Entities\User;
@@ -51,7 +47,7 @@ class Process implements Job
public function __construct(
private EntityManager $entityManager,
private Factory $factory,
private Language $language
private Language $language,
) {}
/**
@@ -65,8 +61,8 @@ class Process implements Job
throw new Error("ID not passed to the mass action job.");
}
/** @var ExportEntity|null $entity */
$entity = $this->entityManager->getEntityById(ExportEntity::ENTITY_TYPE, $id);
/** @var Export|null $entity */
$entity = $this->entityManager->getEntityById(Export::ENTITY_TYPE, $id);
if ($entity === null) {
throw new Error("Export '$id' not found.");
@@ -102,10 +98,9 @@ class Process implements Job
}
}
private function notifyFinish(ExportEntity $entity): void
private function notifyFinish(Export $entity): void
{
/** @var Notification $notification */
$notification = $this->entityManager->getNewEntity(Notification::ENTITY_TYPE);
$notification = $this->entityManager->getRDBRepositoryByClass(Notification::class)->getNew();
$url = '?entryPoint=download&id=' . $entity->getAttachmentId();
@@ -123,24 +118,24 @@ class Process implements Job
$this->entityManager->saveEntity($notification);
}
private function setFailed(ExportEntity $entity): void
private function setFailed(Export $entity): void
{
$entity->setStatus(ExportEntity::STATUS_FAILED);
$entity->setStatus(Export::STATUS_FAILED);
$this->entityManager->saveEntity($entity);
}
private function setRunning(ExportEntity $entity): void
private function setRunning(Export $entity): void
{
$entity->setStatus(ExportEntity::STATUS_RUNNING);
$entity->setStatus(Export::STATUS_RUNNING);
$this->entityManager->saveEntity($entity);
}
private function setSuccess(ExportEntity $entity, Result $result): void
private function setSuccess(Export $entity, Result $result): void
{
$entity
->setStatus(ExportEntity::STATUS_SUCCESS)
->setStatus(Export::STATUS_SUCCESS)
->setAttachmentId($result->getAttachmentId());
$this->entityManager->saveEntity($entity);