Merge branch 'master' of https://github.com/jgoodman/Freeside
[freeside.git] / rt / share / html / m / ticket / show
index 4190bd3..360ef40 100644 (file)
@@ -1,3 +1,50 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC
+%#                                          <sales@bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
 <%args>
 $id => undef
 </%args>
@@ -12,7 +59,7 @@ unless ($id) {
 if ($ARGS{'id'} eq 'new') {
     # {{{ Create a new ticket
 
-    my $Queue = new RT::Queue( $session{'CurrentUser'} );
+    my $Queue = RT::Queue->new( $session{'CurrentUser'} );
     $Queue->Load($ARGS{'Queue'});
     unless ( $Queue->id ) {
         Abort('Queue not found');
@@ -29,7 +76,6 @@ if ($ARGS{'id'} eq 'new') {
     unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
         Abort("No permission to view newly created ticket #".$Ticket->id.".");
     }
-    # }}}
 } else { 
     $Ticket ||= LoadTicket($ARGS{'id'});
 
@@ -37,7 +83,7 @@ if ($ARGS{'id'} eq 'new') {
         TicketObj => $Ticket,
         ActionsRef => \@Actions, ARGSRef => \%ARGS );
     if ( defined $ARGS{'Action'} ) {
-        if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
+        if ($ARGS{'Action'} =~ /^(Steal|Delete|Take|SetTold)$/) {
             my $action = $1;
             my ($res, $msg) = $Ticket->$action();
             push(@Actions, $msg);
@@ -64,11 +110,14 @@ if ($ARGS{'id'} eq 'new') {
     push @Actions, ProcessTicketLinks(   ARGSRef => \%ARGS, TicketObj => $Ticket );
     push @Actions, ProcessTicketDates(   ARGSRef => \%ARGS, TicketObj => $Ticket );
     push @Actions, ProcessObjectCustomFieldUpdates(ARGSRef => \%ARGS, TicketObj => $Ticket );
+    push @Actions, ProcessTicketReminders( ARGSRef => \%ARGS, TicketObj => $Ticket );
 
-    # XXX: we shouldn't block actions here if user has no right to see the ticket,
-    # but we should allow him to see actions he has done
     unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
-        Abort("No permission to view ticket");
+        if (@Actions) {
+            Abort("A change was applied successfully, but you no longer have permissions to view the ticket", Actions => \@Actions);
+        } else {
+            Abort("No permission to view ticket");
+        }
     }
     if ( $ARGS{'MarkAsSeen'} ) {
         $Ticket->SetAttribute(
@@ -111,12 +160,6 @@ while ( my $attach = $Attachments->Next() ) {
    unshift( @{ $documents{ $attach->Filename } }, $attach );
 }
 
-my $Customers = $Ticket->Customers;
-my @customers;
-while ( my $customer = $Customers->Next() ) {
-  push @customers, $customer;
-}
-
 my $CustomFields = $Ticket->CustomFields;
 $m->callback(
     CallbackName => 'MassageCustomFields',
@@ -161,7 +204,7 @@ my $print_value = sub {
 };
 
 </%init>
-<&| /m/_elements/wrapper, title => $Ticket->Subject &>
+<&| /m/_elements/wrapper, title => loc("#[_1]: [_2]", $Ticket->Id, $Ticket->Subject || '') &>
 <div id="ticket-show">
 <& /m/_elements/ticket_menu, ticket => $Ticket &>
 
@@ -204,6 +247,10 @@ my $print_value = sub {
     <div class="label queue"><&|/l&>Queue</&>:</div>
     <div class="value queue"><& /Ticket/Elements/ShowQueue, QueueObj => $Ticket->QueueObj &></div>
   </div>
+ <div class="entry">
+    <div class="label bookmark"><&|/l&>Bookmark</&>:</div>
+    <div class="value bookmark"><& /Ticket/Elements/Bookmark, id => $Ticket->id &></div>
+  </div>
     </&>
 
 % if ($Ticket->CustomFields->First) {
@@ -297,7 +344,7 @@ if ($size) {
 </%PERL>
 
 <li><font size="-2">
-<a href="<%RT->Config->Get('WebPath')%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | u%>">
+<a href="<%RT->Config->Get('WebPath')%>/Ticket/Attachment/<%$rev->TransactionId%>/<%$rev->Id%>/<%$rev->Filename | un%>">
 <&|/l, $rev->CreatedAsString, $size, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3]</&>
 </a>
 </font></li>
@@ -323,19 +370,6 @@ if ($size) {
     </&>
 % }
 
-% if ( @customers ) {
-    <&| /Widgets/TitleBox, title => loc("Customers"),
-        class => 'ticket-info-customers',
-    &>
-%   foreach my $customer ( @customers ) {
-%     my $resolver = $customer->TargetURI->Resolver or next;
-<div class="entry"><a href="<% $resolver->HREF %>"><% $resolver->AsString |n%></A>
-</div>
-%   } #foreach
-    </&>
-% } # if @customers
-
-
     <&| /Widgets/TitleBox, title => loc("Dates"),
         class => 'ticket-info-dates',
     &>