From f6374026e0ff742fcf0ed620c20f758fd664ca02 Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Thu, 17 Sep 2020 14:13:16 +0200 Subject: [PATCH] TT#92700 print journal links of collection items Change-Id: I01f7632013cd38f99261a003fab323acf385dd46 --- lib/NGCP/Panel/Utils/Journal.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/NGCP/Panel/Utils/Journal.pm b/lib/NGCP/Panel/Utils/Journal.pm index da913794d1..7cf2150cfb 100644 --- a/lib/NGCP/Panel/Utils/Journal.pm +++ b/lib/NGCP/Panel/Utils/Journal.pm @@ -480,11 +480,12 @@ sub get_journal_relation_link { my ($resource, $c, $item_id, $id, $relation) = @_; my $resource_name = undef; my $controller = undef; + my $action_name = $id ? 'handle_journalsitem_get' : 'handle_journals_get'; if (ref $resource eq 'HASH') { $resource_name = $resource->{resource_name}; } elsif ((defined blessed($resource)) && $resource->can('resource_name')) { #both controllers and journal rows $resource_name = $resource->resource_name; - if ($resource->can('get_config')) { + if ($resource->can('get_config') and exists $resource->get_config('action')->{$action_name}) { $controller = $resource; } } elsif (!ref $resource) { @@ -496,8 +497,9 @@ sub get_journal_relation_link { $controller = NGCP::Panel::Utils::API::get_module_by_resource($c, $resource_name, $item_id); } if ($controller->can('get_config')) { - my $action_name = $id ? 'handle_journalsitem_get' : 'handle_journals_get'; - $allowed_roles = $controller->get_config('action')->{$action_name}->{AllowedRole}; + if (exists $controller->get_config('action')->{$action_name}) { + $allowed_roles = $controller->get_config('action')->{$action_name}->{AllowedRole}; + } } if (grep { $_ eq $c->user->roles } @$allowed_roles) { if (defined $id) {