Master to 4.2.8
[usit-rt.git] / share / html / Elements / ShowTransaction
index bbef46c..74f5c26 100644 (file)
@@ -68,7 +68,7 @@
 
   <div class="content">
 <%PERL>
-$m->comp('/Elements/ShowCustomFields', Object => $Transaction ) if $HasTxnCFs;
+$m->comp('/Elements/ShowCustomFields', Object => $Transaction, HideEmpty => 1 ) if $HasTxnCFs;
 $m->comp(
     'ShowTransactionAttachments',
     %ARGS,
@@ -132,7 +132,7 @@ if ( $Object->id != $Transaction->ObjectId ) {
 my $date = $Transaction->CreatedAsString;
 
 my $time = '';
-$time = loc('[quant,_1,min,min]', $Transaction->TimeTaken)
+$time = loc('[quant,_1,minute,minutes]', $Transaction->TimeTaken)
     if $Transaction->TimeTaken;
 
 if ( $ShowBody && !$Attachments ) {
@@ -144,86 +144,84 @@ if ( $ShowBody && !$Attachments ) {
 }
 
 my @actions = ();
-if ( $ShowActions ) {
-    my $txn_type = $Transaction->Type;
-    if ( $txn_type =~ /EmailRecord$/ ) {
-        push @actions, {
-            title  => loc('Show'),
-            target => '_blank',
-            path   => $EmailRecordPath
-                .'?id='. $Object->id
-                .'&Transaction='. $Transaction->id
-                .'&Attachment='. ( $Attachments->{0}[0] && $Attachments->{0}[0]->id ),
-        } if $EmailRecordPath;
+my $txn_type = $Transaction->Type;
+if ( $txn_type =~ /EmailRecord$/ ) {
+    push @actions, {
+        title  => loc('Show'),
+        target => '_blank',
+        path   => $EmailRecordPath
+            .'?id='. $Object->id
+            .'&Transaction='. $Transaction->id
+            .'&Attachment='. ( $Attachments->{0}[0] && $Attachments->{0}[0]->id ),
+    } if $EmailRecordPath;
 
-        $ShowBody = 0;
-    }
+    $ShowBody = 0;
+}
 
-    # If the transaction has anything attached to it at all
-    elsif ( %$Attachments ) {
-        my %has_right = map {
-            $_ => RT::ACE->CanonicalizeRightName( $_ . $record_type )
-        } qw(Modify CommentOn ReplyTo);
-        $has_right{'Forward'} = RT::ACE->CanonicalizeRightName('ForwardMessage');
+# If the transaction has anything attached to it at all
+elsif ( %$Attachments && $ShowActions ) {
+    my %has_right = map {
+        $_ => RT::ACE->CanonicalizeRightName( $_ . $record_type )
+    } qw(Modify CommentOn ReplyTo);
+    $has_right{'Forward'} = RT::ACE->CanonicalizeRightName('ForwardMessage');
 
-        my $can_modify = $has_right{'Modify'}
-            && $Object->CurrentUserHasRight( $has_right{'Modify'} );
+    my $can_modify = $has_right{'Modify'}
+        && $Object->CurrentUserHasRight( $has_right{'Modify'} );
 
-        if ( $UpdatePath && $has_right{'ReplyTo'}
-            && ( $can_modify
-                || $Object->CurrentUserHasRight( $has_right{'ReplyTo'} )
-            )
-        ) {
-            push @actions, {
-                class  => "reply-link",
-                title  => loc('Reply'),
-                path   => $UpdatePath
-                    .'?id='. $Object->id
-                    .'&QuoteTransaction='. $Transaction->id
-                    .'&Action=Respond'
-                ,
-            };
-        }
-        if ( $UpdatePath && $has_right{'CommentOn'}
-            && ( $can_modify
-                || $Object->CurrentUserHasRight( $has_right{'CommentOn'} )
-            )
-        ) {
-            push @actions, {
-                class  => "comment-link",
-                title  => loc('Comment'),
-                path   => $UpdatePath
-                    .'?id='. $Object->id
-                    .'&QuoteTransaction='. $Transaction->id
-                    .'&Action=Comment'
-                ,
-            };
-        }
-        if ( $ForwardPath && $has_right{'Forward'}
-            && $Object->CurrentUserHasRight( $has_right{'Forward'} )
-        ) {
-            push @actions, {
-                class  => "forward-link",
-                title  => loc('Forward'),
-                path   => $ForwardPath
-                    .'?id='. $Object->id
-                    .'&QuoteTransaction='. $Transaction->id
-                ,
-            };
-        }
-        if ( $EncryptionPath && $can_modify
-            && RT->Config->Get('Crypt')->{'Enable'}
-            && RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'}
-        ) {
-            push @actions, {
-                class  => "encryption-link",
-                title  => loc('Encrypt/Decrypt'),
-                path   => $EncryptionPath
-                    .'?id='. $Transaction->id
-                    .'&QuoteTransaction='. $Transaction->id
-                ,
-            };
-        }
+    if ( $UpdatePath && $has_right{'ReplyTo'}
+        && ( $can_modify
+            || $Object->CurrentUserHasRight( $has_right{'ReplyTo'} )
+        )
+    ) {
+        push @actions, {
+            class  => "reply-link",
+            title  => loc('Reply'),
+            path   => $UpdatePath
+                .'?id='. $Object->id
+                .'&QuoteTransaction='. $Transaction->id
+                .'&Action=Respond'
+            ,
+        };
+    }
+    if ( $UpdatePath && $has_right{'CommentOn'}
+        && ( $can_modify
+            || $Object->CurrentUserHasRight( $has_right{'CommentOn'} )
+        )
+    ) {
+        push @actions, {
+            class  => "comment-link",
+            title  => loc('Comment'),
+            path   => $UpdatePath
+                .'?id='. $Object->id
+                .'&QuoteTransaction='. $Transaction->id
+                .'&Action=Comment'
+            ,
+        };
+    }
+    if ( $ForwardPath && $has_right{'Forward'}
+        && $Object->CurrentUserHasRight( $has_right{'Forward'} )
+    ) {
+        push @actions, {
+            class  => "forward-link",
+            title  => loc('Forward'),
+            path   => $ForwardPath
+                .'?id='. $Object->id
+                .'&QuoteTransaction='. $Transaction->id
+            ,
+        };
+    }
+    if ( $EncryptionPath && $can_modify
+        && RT->Config->Get('Crypt')->{'Enable'}
+        && RT->Config->Get('Crypt')->{'AllowEncryptDataInDB'}
+    ) {
+        push @actions, {
+            class  => "encryption-link",
+            title  => loc('Encrypt/Decrypt'),
+            path   => $EncryptionPath
+                .'?id='. $Transaction->id
+                .'&QuoteTransaction='. $Transaction->id
+            ,
+        };
     }
 }
 
@@ -237,6 +235,7 @@ $m->callback(
     Created     => \$date,
     TimeTaken   => \$time,
     Description => \$desc,
+    ShowBody    => \$ShowBody,
 );
 
 my $actions = '';