Skip to content

Commit

Permalink
fix(issue): access to tickets
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Jun 13, 2021
1 parent b1153e4 commit 38376d9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,27 @@ function plugin_init_formcreator() {
if (isset($decodedUrl['forcetab'])) {
Session::setActiveTab(Ticket::class, $decodedUrl['forcetab']);
}

// When an issue has a single target ticket
$issue = new PluginFormcreatorIssue();
$issue->getFromDBByCrit([
'sub_itemtype' => Ticket::class,
'original_id' => (int) $_GET['id']
]);
if ($issue->isNewItem()) {
if (!$issue->isNewItem()) {
Html::redirect($issue->getFormURLWithID($issue->getID()) . $openItilFollowup);
}

// When a target has several target tickets
$itemTicket = new Item_Ticket();
$itemTicket->getFromDBByCrit([
'itemtype' => PluginFormcreatorFormAnswer::class,
'tickets_id' => (int) $_GET['id']
]);
if ($itemTicket->isNewItem()) {
// No formanswer found
Html::displayNotFoundError();
}
Html::redirect($issue->getFormURLWithID($issue->getID()) . $openItilFollowup);
}
}

Expand Down

0 comments on commit 38376d9

Please sign in to comment.