added new warehouseorder features

This commit is contained in:
Luca Haid
2025-03-07 08:04:36 +01:00
parent d24c1cc5dc
commit 7e3b1af54a
11 changed files with 460 additions and 119 deletions

View File

@@ -223,8 +223,8 @@ class WarehouseShippingNoteController extends TTCrud {
}
}
protected function createPDFAction() {
$id = $this->request->id;
public function createPDFAction($returnFilename = false, $idOverride = null) {
$id = $idOverride ?? $this->request->id;
if (strlen($id) < 1) {
http_response_code(500);
self::returnJson(['success' => false, 'message' => 'Lieferschein wurde nicht gefunden']);
@@ -376,10 +376,13 @@ class WarehouseShippingNoteController extends TTCrud {
$wkhtmltopdfArgs = "--header-html $headerFile --footer-html $footerFile";
$filename = $pdf->render($wkhtmltopdfArgs);
if ($returnFilename === true) return $filename;
// return the pdf and die so the client sees the pdf not the filename
header('Content-Type: application/pdf');
header('Content-Disposition: inline; filename="' . $filename . '"');
readfile($filename);
die();
}
// TODO: either move this to UserController or make it better