feat: feature flags for sanitizing and stamping of uploads

This commit is contained in:
Björn Fromme
2025-03-18 18:14:25 +01:00
parent 3ad8b59ba1
commit ca8997ab19
7 changed files with 178 additions and 10 deletions
@@ -12,6 +12,7 @@ use App\Htmx\HxRedirectResponse;
use App\Model\DocumentCheckDto;
use App\Service\Pdf\InvoiceApprover;
use Doctrine\ORM\EntityManagerInterface;
use Flagception\Manager\FeatureManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\DependencyInjection\Attribute\Target;
@@ -32,7 +33,8 @@ class CheckController extends AbstractController
private readonly WorkflowInterface $workflow,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly InvoiceApprover $invoiceApprover,
private readonly LoggerInterface $logger
private readonly LoggerInterface $logger,
private readonly FeatureManagerInterface $featureManager,
) {
}
@@ -125,11 +127,13 @@ class CheckController extends AbstractController
->setStatus($status)
;
if (Upload::TYPE_INVOICE === $document->getType()) {
try {
$this->invoiceApprover->render($document->getDisposition());
} catch (\InvalidArgumentException $e) {
$this->addFlash('error', 'Die Honorarnote ist nicht als PDF hochgeladen worden');
if (true === $this->featureManager->isActive('stamp_invoices')) {
if (Upload::TYPE_INVOICE === $document->getType()) {
try {
$this->invoiceApprover->render($document->getDisposition());
} catch (\InvalidArgumentException $e) {
$this->addFlash('error', 'Die Honorarnote ist nicht als PDF hochgeladen worden');
}
}
}