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

Michel Rodriguez michel at bestpractical.com
Thu Feb 27 08:21:59 EST 2020


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

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

    Add link back to the ticket from a single transaction page.
    
    The button goes in the top menu.
    Add a hash of button texts to make translation easier.

diff --git a/lib/RT/Interface/Web/MenuBuilder.pm b/lib/RT/Interface/Web/MenuBuilder.pm
index 41b6b4c2c..31a07406d 100644
--- a/lib/RT/Interface/Web/MenuBuilder.pm
+++ b/lib/RT/Interface/Web/MenuBuilder.pm
@@ -454,6 +454,22 @@ sub BuildMainNav {
         }
     }
 
+    # display "View 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 );
+            my $object = $txn->Object;
+            if ( $object->Id ) {
+                my $object_type = $object->RecordType;
+                if ( $object_type eq 'Ticket' ) {
+                    $page->child( view_ticket => title => loc("View ticket"), path => "/Ticket/Display.html?id=" . $object->Id );
+                }
+            }
+        }
+    }
+
     # Scope here so we can share in the Privileged callback
     my $args      = '';
     my $has_query = '';

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


More information about the rt-commit mailing list