[Rt-commit] rt branch, 4.6/link-transaction-to-ticket-page, repushed
Michel Rodriguez
michel at bestpractical.com
Fri Jan 24 08:54:23 EST 2020
The branch 4.6/link-transaction-to-ticket-page was deleted and repushed:
was 24bffc57d263f6cded33beaa52d1e5affe12580c
now 595aa4d369a94b19167ff2e02c7a81fe5938678e
1: 24bffc57d2 ! 1: 636f99a106 Add link back to the ticket to a single transaction page.
@@ -17,18 +17,19 @@
}
}
-+ # display "Back to ticket" link in transactions
++ # 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 $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 );
++ 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 );
+ }
+ }
+ }
@@ -37,3 +38,4 @@
# Scope here so we can share in the Privileged callback
my $args = '';
my $has_query = '';
+
-: ------- > 2: 595aa4d369 Generate links to single transaction display in the Ticket history page.
More information about the rt-commit
mailing list