diff --git a/phpunit/functional/TicketTest.php b/phpunit/functional/TicketTest.php index 3a693630fbb..27099ec9115 100644 --- a/phpunit/functional/TicketTest.php +++ b/phpunit/functional/TicketTest.php @@ -1591,6 +1591,7 @@ private function checkFormOutput( $requestSource = true, $location = true, $itil_form = true, + $cancel_ticket = false, ) { ob_start(); $ticket->showForm($ticket->getID()); @@ -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( @@ -1716,6 +1725,7 @@ public function testFormPostOnly() requestSource: false, location: false, itil_form: false, + cancel_ticket: true, ); $uid = getItemByTypeName('User', TU_USER, true); @@ -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 @@ -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 ); } diff --git a/templates/components/itilobject/footer.html.twig b/templates/components/itilobject/footer.html.twig index e0c5056014a..e8e1da6531e 100644 --- a/templates/components/itilobject/footer.html.twig +++ b/templates/components/itilobject/footer.html.twig @@ -108,7 +108,7 @@
- {% if item.canDeleteItem() %} + {% if item.canDeleteItem() and is_helpdesk %}