[Rt-commit] rt branch, 4.6/link-transaction-to-ticket-page, created. rt-4.4.4-649-g24bffc57d2

Michel Rodriguez michel at bestpractical.com
Mon Jan 13 08:44:58 EST 2020


The branch, 4.6/link-transaction-to-ticket-page has been created
        at  24bffc57d263f6cded33beaa52d1e5affe12580c (commit)

- Log -----------------------------------------------------------------
commit 24bffc57d263f6cded33beaa52d1e5affe12580c
Author: michel <michel at bestpractical.com>
Date:   Mon Jan 13 14:39:26 2020 +0100

    Add link back to the ticket to a single transaction page.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 41b6b4c2c3..eaad8d884a 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -308,7 +308,6 @@ sub BuildMainNav {
         }
     }
 
-
     if ( $request_path =~ m{^/Ticket/} ) {
         if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
             my $id  = $1;
@@ -454,6 +453,23 @@ sub BuildMainNav {
         }
     }
 
+    # display "Back to ticket" link in transactions
+    if ( $request_path =~ m{^/Transaction/Display.html} ) {
+        if ( ( $HTML::Mason::Commands::DECODED_ARGS->{'id'} || '' ) =~ /^(\d+)$/ ) {
+            my $txn_id = $1;
+            my $txn = RT::Transaction->new( $current_user );
+            $txn->Load( $txn_id );
+            if ( $txn and $txn->id ) {
+                my $ticket_id = $txn->ObjectId;
+                my $ticket = RT::Ticket->new( $current_user );
+                $ticket->Load( $ticket_id );
+                if ( $ticket->id and $ticket->CurrentUserHasRight( 'ShowTicket' ) ) {
+                    $page->child( ticket => title => loc('Back to ticket'), path => "/Ticket/Display.html?id=" . $ticket_id );
+                }
+            }
+        }
+    }
+
     # Scope here so we can share in the Privileged callback
     my $args      = '';
     my $has_query = '';

-----------------------------------------------------------------------


More information about the rt-commit mailing list