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

Michel Rodriguez michel at bestpractical.com
Fri Jan 24 08:54:20 EST 2020


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

- Log -----------------------------------------------------------------
commit 636f99a1064202e8cf9e9e511adde97e657f580e
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..fdcba53455 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,24 @@ sub BuildMainNav {
         }
     }
 
+    # display "Back to <object>" 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 $object = $txn->Object;
+                if ( $object ) {
+                    my( $object_type ) = $object->RecordType;
+                    # This assumes that the object type can be used to describe the object (in "Back to $object_type")
+                    # and that displaying the object is done in /$object_type/Display.html?id=<id>
+                    $page->child( object_type => title => loc( "Back to") . ' ' . loc( $object_type), path => "/$object_type/Display.html?id=" . $object->Id );
+                }
+            }
+        }
+    }
+
     # Scope here so we can share in the Privileged callback
     my $args      = '';
     my $has_query = '';

commit 595aa4d369a94b19167ff2e02c7a81fe5938678e
Author: michel <michel at bestpractical.com>
Date:   Fri Jan 24 13:26:35 2020 +0100

    Generate links to single transaction display in the Ticket history page.
    
    Allow for other object types to generate links to the single transaction
    page.

diff --git a/share/html/Elements/ShowTransaction b/share/html/Elements/ShowTransaction
index e6b797fb3c..01e22bd312 100644
--- a/share/html/Elements/ShowTransaction
+++ b/share/html/Elements/ShowTransaction
@@ -52,7 +52,7 @@
 % }
     <span class="type">
       <a name="txn-<% $Transaction->id %>" \
-% if ( $DisplayPath ) {
+% if ( $DisplayPath && ! ( $DisplayPath eq 'History.html' && $can_display_transaction ) ) {
       href="<% $DisplayPath %>?id=<% $Object->id %>#txn-<% $Transaction->id %>" \
 % } elsif ( $HTML::Mason::Commands::r->path_info =~ m{^/SelfService/} ) {
       href="<% RT->Config->Get('WebPath') %>/SelfService/Transaction/Display.html?id=<% $Transaction->id %>" \
@@ -112,6 +112,10 @@ $EmailRecordPath => undef
 <%INIT>
 my $record_type = $Object->RecordType;
 my $type_class  = $Object->ClassifyTransaction( $Transaction );
+# this is the list of object types that support displaying individual transactions
+# only tickets for now
+my %can_display_transaction = map { $_ => 1 } qw( Ticket );
+my $can_display_transaction = $can_display_transaction{$record_type};
 
 $m->callback(
     CallbackName => 'MassageTypeClass',

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


More information about the rt-commit mailing list