From 86692a8c88a75f88936e1f08feda92c84d99ef6a Mon Sep 17 00:00:00 2001 From: sunnavy Date: Mon, 11 Dec 2023 14:45:05 -0500 Subject: [PATCH] Take care of SelfService when building asset action menu for "Assets" widget Not only for privileged page menu, _BuildAssetMenuActionSubmenu is also used to build asset action menu in "Assets" widget on ticket display page, which may show up in SelfService. --- lib/RT/Interface/Web/MenuBuilder.pm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm index 57c7240d57d..f786616332e 100644 --- a/lib/RT/Interface/Web/MenuBuilder.pm +++ b/lib/RT/Interface/Web/MenuBuilder.pm @@ -1053,9 +1053,16 @@ sub _BuildAssetMenuActionSubmenu { my $asset = $args{Asset}; my $id = $asset->id; + my $is_self_service = $request_path =~ m{^/SelfService/} ? 1 : 0; my $actions = $page->child("actions", title => HTML::Mason::Commands::loc("Actions")); - $actions->child("create-linked-ticket", title => HTML::Mason::Commands::loc("Create linked ticket"), path => "/Asset/CreateLinkedTicket.html?Asset=$id"); + $actions->child( + "create-linked-ticket", + title => HTML::Mason::Commands::loc("Create linked ticket"), + path => ( $is_self_service ? '/SelfService' : '' ) . "/Asset/CreateLinkedTicket.html?Asset=$id" + ); + + return if $is_self_service; my $status = $asset->Status; my $lifecycle = $asset->LifecycleObj;