[Rt-commit] rt branch, 4.6/link-transaction-to-ticket-page, created. rt-4.4.4-649-ga220b8637
Michel Rodriguez
michel at bestpractical.com
Wed Feb 26 15:12:03 EST 2020
The branch, 4.6/link-transaction-to-ticket-page has been created
at a220b8637ddbb9f01b8477be34d8620f4a373afc (commit)
- Log -----------------------------------------------------------------
commit a220b8637ddbb9f01b8477be34d8620f4a373afc
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..2e4e36087 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,27 @@ 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;
+ # the button_text is here to make translation support easier: "Return to $object_type" does not have a
+ # single translation in many languages
+ my %button_text = ( Ticket => loc( "Return to ticket" ) );
+ # 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 => $button_text{$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 = '';
diff --git a/share/html/Ticket/History.html b/share/html/Ticket/History.html
index f617380d1..8e3208ee1 100644
--- a/share/html/Ticket/History.html
+++ b/share/html/Ticket/History.html
@@ -58,7 +58,6 @@
ShowHeaders => $ARGS{'ShowHeaders'},
Attachments => $attachments,
AttachmentContent => $attachment_content,
- DisplayPath => 'History.html',
&>
% $m->callback( %ARGS, CallbackName => 'AfterShowHistory', Ticket => $Ticket );
-----------------------------------------------------------------------
More information about the rt-commit
mailing list