added new warehouseorder features
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user