diff --git a/inc/entity.class.php b/inc/entity.class.php index d0f1768..726ea6d 100644 --- a/inc/entity.class.php +++ b/inc/entity.class.php @@ -167,7 +167,7 @@ public static function showForItemtype(Entity $entity, $itemtype = 'Entity') $canedit = $itemtype === 'Entity' && $entity->canEdit($ID); - if ($itemtype === 'Entity') { + if ($itemtype === 'Entity' && $canedit) { PluginCreditEntityConfig::showEntityConfigForm($entity->getID()); } @@ -244,7 +244,7 @@ public static function showForItemtype(Entity $entity, $itemtype = 'Entity') 'itemtype' => PluginCreditEntity::class, ]; - if ($itemtype === 'Entity' && $canedit) { + if ($itemtype === 'Entity') { TemplateRenderer::getInstance()->display('@credit/creditentity.hmtl.twig', [ 'form_url' => self::getFormUrl(), 'credittypeclass' => PluginCreditType::class, diff --git a/inc/ticket.class.php b/inc/ticket.class.php index 65bfcdf..8d0a5d3 100644 --- a/inc/ticket.class.php +++ b/inc/ticket.class.php @@ -220,16 +220,18 @@ public static function showForTicket(Ticket $ticket) $entries = []; - if ($number && $canedit) { - $massiveactionparams = [ - 'num_displayed' => min($number, $_SESSION['glpilist_limit']), - 'container' => 'mass' . self::class . $rand, - 'itemtype' => PluginCreditTicket::class, - 'specific_actions' => [ - 'update' => _x('button', 'Update'), - 'purge' => _x('button', 'Delete permanently'), - ], - ]; + if ($number) { + if ($canedit) { + $massiveactionparams = [ + 'num_displayed' => min($number, $_SESSION['glpilist_limit']), + 'container' => 'mass' . self::class . $rand, + 'itemtype' => PluginCreditTicket::class, + 'specific_actions' => [ + 'update' => _x('button', 'Update'), + 'purge' => _x('button', 'Delete permanently'), + ], + ]; + } foreach (self::getAllForTicket($ID) as $data) { $credit_entity = new PluginCreditEntity(); $credit_entity->getFromDB($data['plugin_credit_entities_id']); diff --git a/templates/creditentity.hmtl.twig b/templates/creditentity.hmtl.twig index 93343df..efc143f 100644 --- a/templates/creditentity.hmtl.twig +++ b/templates/creditentity.hmtl.twig @@ -30,6 +30,7 @@ {% import "components/form/fields_macros.html.twig" as fields %} {% set rand = random() %} +{% if canedit %}