added inline disposition for PDF previews (#3486)

This commit is contained in:
Alexander Pankow
2022-09-04 12:15:47 +02:00
committed by GitHub
parent 1d1f5835da
commit 2fbbbe7260
9 changed files with 107 additions and 10 deletions

View File

@@ -9,6 +9,7 @@
namespace App\Controller;
use App\Export\Base\DispositionInlineInterface;
use App\Export\ExportItemInterface;
use App\Export\ServiceExport;
use App\Export\TooManyItemsExportException;
@@ -117,6 +118,11 @@ class ExportController extends AbstractController
throw $this->createNotFoundException('Unknown export renderer');
}
// display file inline if supported and `markAsExported` is not set
if ($renderer instanceof DispositionInlineInterface && !$query->isMarkAsExported()) {
$renderer->setDispositionInline(true);
}
$entries = $this->getEntries($query);
$response = $renderer->render($entries, $query);

View File

@@ -168,7 +168,7 @@ final class InvoiceController extends AbstractController
$query->setCustomers([$customer]);
$model = $this->service->createModel($query);
return $this->service->renderInvoiceWithModel($model, $this->dispatcher);
return $this->service->renderInvoiceWithModel($model, $this->dispatcher, true);
} catch (Exception $ex) {
$this->logException($ex);
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);