|
57 | 57 | PluginFormcreatorCommon::saveLayout();
|
58 | 58 | $_SESSION['glpilayout'] = "lefttab";
|
59 | 59 |
|
60 |
| -if (Session::getCurrentInterface() == "helpdesk") { |
61 |
| - Html::helpHeader(__('Service catalog', 'formcreator')); |
62 |
| -} else { |
63 |
| - Html::header(__('Service catalog', 'formcreator')); |
64 |
| -} |
65 | 60 | /** @var PluginFormcreatorIssue $issue */
|
66 | 61 | $issue = PluginFormcreatorIssue::getById((int) $_REQUEST['id']);
|
67 |
| -if ($issue === false) { |
| 62 | + |
| 63 | +if ($issue) { |
| 64 | + $itemtype = $issue->fields['itemtype']; |
| 65 | + |
| 66 | + // Trick to change the displayed id as Html::includeHeader() rely on request data |
| 67 | + $old_id = $_GET['id']; |
| 68 | + $_GET['id'] = $issue->fields['display_id']; |
| 69 | + |
| 70 | + // Specific case, viewing a ticket from a formanswer result |
| 71 | + if ($itemtype == PluginFormcreatorFormAnswer::class && isset($_GET['tickets_id'])) { |
| 72 | + $itemtype = Ticket::class; |
| 73 | + $_GET['id'] = "f_$_GET[tickets_id]"; |
| 74 | + } |
| 75 | + |
| 76 | + $header = $itemtype::getTypeName(1); |
| 77 | + if (Session::getCurrentInterface() == "helpdesk") { |
| 78 | + Html::helpHeader($header); |
| 79 | + } else { |
| 80 | + Html::header($header); |
| 81 | + } |
| 82 | + |
| 83 | + // Reset request param in case some other code depends on it |
| 84 | + $_GET['id'] = $old_id; |
| 85 | + |
| 86 | + $issue->display($_REQUEST); |
| 87 | +} else { |
| 88 | + $header = __('Item not found'); |
| 89 | + if (Session::getCurrentInterface() == "helpdesk") { |
| 90 | + Html::helpHeader($header); |
| 91 | + } else { |
| 92 | + Html::header($header); |
| 93 | + } |
68 | 94 | PluginFormcreatorCommon::restoreLayout();
|
69 | 95 | Html::displayNotFoundError();
|
70 | 96 | }
|
71 |
| -$issue->display($_REQUEST); |
72 | 97 |
|
73 | 98 | if (Session::getCurrentInterface() == "helpdesk") {
|
74 | 99 | Html::helpFooter();
|
|
0 commit comments