rt 4.2.14 (#13852)
[freeside.git] / rt / share / html / Ticket / Display.html
index 50df598..2851d0b 100755 (executable)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -54,6 +54,7 @@
 
 <& /Elements/ListActions, actions => \@Actions &>
 <& Elements/ShowUpdateStatus, Ticket => $TicketObj &>
+<& Elements/ShowDependencyStatus, Ticket => $TicketObj &>
 
 % $m->callback( %ARGS, Ticket => $TicketObj, Transactions => $transactions, Attachments => $attachments, CallbackName => 'BeforeShowSummary' );
 <div class="summary">
 
 % $m->callback( Ticket => $TicketObj, %ARGS, Transactions => $transactions, Attachments => $attachments, CallbackName => 'BeforeShowHistory' );
 
-% if (not $ForceShowHistory and RT->Config->Get( 'DeferTransactionLoading', $session{'CurrentUser'} )) {
+% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+% if ($ShowHistory eq "delay") {
+    <& /Ticket/Elements/DelayShowHistory,
+        Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
+    &>
+% } elsif (not $ForceShowHistory and $ShowHistory eq "click") {
     <& /Ticket/Elements/ClickToShowHistory,
         Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
     &>
 % } else {
-    <& /Ticket/Elements/ShowHistory ,
-          Ticket => $TicketObj,
-          Tickets => $Tickets,
+    <& /Elements/ShowHistory ,
+          Object => $TicketObj,
           Transactions => $transactions,
-          Collapsed => $ARGS{'Collapsed'},
           ShowHeaders => $ARGS{'ShowHeaders'},
           Attachments => $attachments,
           AttachmentContent => $attachment_content
@@ -92,8 +98,8 @@
 $id => undef
 $TicketObj => undef
 $ShowHeaders => 0
-$Collapsed => undef
 $ForceShowHistory => 0
+$RedirectToBasics => 0
 </%ARGS>
 
 <%INIT>
@@ -107,7 +113,7 @@ if ( ! $ARGS{'NoRedirect'} && RT::Interface::Web->MobileClient()) {
 }
 
 
-my (@Actions, $Tickets, $title);
+my (@Actions, $title);
 
 
 unless ($id || $TicketObj) {
@@ -115,7 +121,7 @@ unless ($id || $TicketObj) {
 }
 
 if ($ARGS{'id'} eq 'new') {
-    # {{{ Create a new ticket
+    # Create a new ticket
 
     # Massage customer IDs into member links.
     my @cust_uris = map { 
@@ -135,10 +141,7 @@ if ($ARGS{'id'} eq 'new') {
         Abort('You have no permission to create tickets in that queue.');
     }
 
-    ($TicketObj, @Actions) = CreateTicket(
-        Attachments => delete $session{'Attachments'},
-        %ARGS,
-    );
+    ($TicketObj, @Actions) = CreateTicket( %ARGS );
     unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) {
         Abort("No permission to view newly created ticket #".$TicketObj->id.".");
     }
@@ -150,7 +153,7 @@ if ($ARGS{'id'} eq 'new') {
     my $SkipProcessing;
 
     $m->callback( CallbackName => 'BeforeProcessArguments',
-        TicketObj => $TicketObj, Tickets => $Tickets,
+        TicketObj => $TicketObj,
         ActionsRef => \@Actions, ARGSRef => \%ARGS,
         SkipProcessing => \$SkipProcessing );
 
@@ -168,21 +171,18 @@ if ($ARGS{'id'} eq 'new') {
                 ARGSRef => \%ARGS, 
                 Actions => \@Actions);
         
-        $ARGS{UpdateAttachments} = $session{'Attachments'};
-        push @Actions,
-            ProcessUpdateMessage(
+        push @Actions, ProcessUpdateMessage(
             ARGSRef   => \%ARGS,
             Actions   => \@Actions,
             TicketObj => $TicketObj,
-            );
-        delete $session{'Attachments'};
+        );
 
         #Process status updates
         push @Actions, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $TicketObj );
         push @Actions, ProcessTicketBasics(  ARGSRef => \%ARGS, TicketObj => $TicketObj );
         push @Actions, ProcessTicketLinks(   ARGSRef => \%ARGS, TicketObj => $TicketObj );
         push @Actions, ProcessTicketDates(   ARGSRef => \%ARGS, TicketObj => $TicketObj );
-        push @Actions, ProcessTicketCustomFieldUpdates(ARGSRef => \%ARGS, TicketObj => $TicketObj );
+        push @Actions, ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS, TicketObj => $TicketObj );
         # If this fails due to required fields being empty, it will set
         # notes('RedirectToBasics').
         push @Actions, ProcessTicketStatus(  ARGSRef => \%ARGS, TicketObj => $TicketObj );
@@ -212,13 +212,13 @@ $title = loc("Ticket #[_1]: [_2]", $TicketObj->Id, $TicketObj->Subject || '');
 $m->callback(
     CallbackName => 'BeforeDisplay',
     TicketObj => \$TicketObj,
-    Tickets => \$Tickets,
     Actions => \@Actions,
     title => \$title,
     ARGSRef => \%ARGS,
 );
 
 # This code does automatic redirection if any updates happen. 
+$m->notes('RedirectToBasics' => 1) if $RedirectToBasics;
 my $path = '/Ticket/'. ( $m->notes('RedirectToBasics') ? 'Modify.html'
                                                        : 'Display.html' );
 MaybeRedirectForResults(
@@ -231,10 +231,9 @@ MaybeRedirectForResults(
     Arguments => { id => $TicketObj->id },
 );
 
-# Get the transactoins before the attachments, for great ACL justice
-my $transactions = $m->comp('Elements/FindTransactions',Ticket => $TicketObj, Tickets => $Tickets || undef);
-my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
-my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);
+my $transactions = $TicketObj->SortedTransactions;
+my $attachments = $TicketObj->Attachments;
+my $attachment_content = $TicketObj->TextAttachments;
 
 my %link_rel;
 if (defined $session{'tickets'} and ($ARGS{'Query'} or $session{'CurrentSearchHash'}->{'Query'})) {