Merge pull request #4044 from Icinga/fix/pdf-export-error-handling
Fix pdf export error handling
This commit is contained in:
commit
8da37e5ca2
|
@ -51,14 +51,19 @@ class Pdf
|
|||
Environment::raiseExecutionTime(300);
|
||||
|
||||
$viewRenderer = $controller->getHelper('viewRenderer');
|
||||
$controller->render(
|
||||
$viewRenderer->getScriptAction(),
|
||||
$viewRenderer->getResponseSegment(),
|
||||
$viewRenderer->getNoController()
|
||||
);
|
||||
$layout = $controller->getHelper('layout')->setLayout('pdf');
|
||||
$viewRenderer->postDispatch();
|
||||
|
||||
$layoutHelper = $controller->getHelper('layout');
|
||||
$oldLayout = $layoutHelper->getLayout();
|
||||
$layout = $layoutHelper->setLayout('pdf');
|
||||
|
||||
$layout->content = $controller->getResponse();
|
||||
$html = $layout->render();
|
||||
|
||||
// Restore previous layout and reset content, to properly show errors
|
||||
$controller->getResponse()->clearBody($viewRenderer->getResponseSegment());
|
||||
$layoutHelper->setLayout($oldLayout);
|
||||
|
||||
$imgDir = Url::fromPath('img');
|
||||
$html = preg_replace(
|
||||
'~src="' . $imgDir . '/~',
|
||||
|
|
|
@ -483,9 +483,9 @@ class ActionController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
if ($req->getParam('format') === 'pdf') {
|
||||
$this->shutdownSession();
|
||||
if ($req->getParam('error_handler') === null && $req->getParam('format') === 'pdf') {
|
||||
$this->sendAsPdf();
|
||||
$this->shutdownSession();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue