Skip to content

Commit

Permalink
Fix cancel ticket button on central
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrienClairembault authored and trasher committed Feb 10, 2025
1 parent a8e8bdb commit 236d6b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions phpunit/functional/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,7 @@ private function checkFormOutput(
$requestSource = true,
$location = true,
$itil_form = true,
$cancel_ticket = false,
) {
ob_start();
$ticket->showForm($ticket->getID());
Expand Down Expand Up @@ -1664,6 +1665,14 @@ private function checkFormOutput(
($itil_form === true ? 'ITIL form' : 'ITIL form present') . ' ' . $caller
);

// Cancel ticket button
$matches = iterator_to_array($crawler->filter("button:contains('Cancel ticket')"));
$this->assertCount(
($cancel_ticket === true ? 1 : 0),
$matches,
'Cancel ticket ' . ($cancel_ticket === true ? 'missing' : 'present')
);


//Assign to
/*preg_match(
Expand Down Expand Up @@ -1716,6 +1725,7 @@ public function testFormPostOnly()
requestSource: false,
location: false,
itil_form: false,
cancel_ticket: true,
);

$uid = getItemByTypeName('User', TU_USER, true);
Expand Down Expand Up @@ -1748,6 +1758,7 @@ public function testFormPostOnly()
$requestSource = false,
$location = false,
itil_form: false,
cancel_ticket: false, // Can no longer cancel once a followup is added
);

// Display extra fields
Expand All @@ -1773,6 +1784,7 @@ public function testFormPostOnly()
requestSource: false,
location: false,
itil_form: true,
cancel_ticket: false, // Can no longer cancel once a followup is added
);
}

Expand Down
2 changes: 1 addition & 1 deletion templates/components/itilobject/footer.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@

<div class="ms-auto"></div>

{% if item.canDeleteItem() %}
{% if item.canDeleteItem() and is_helpdesk %}
<button class="btn btn-ghost-danger me-2" type="submit" name="delete" form="itil-form">
<i class="ti ti-trash me-1"></i>
<span>{{ __("Cancel ticket") }}</span>
Expand Down

0 comments on commit 236d6b8

Please sign in to comment.