X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2Fm%2Fticket%2Fshow;h=4d60043e0d253ffa2343a48b2eb43887167cee4a;hb=de9d037528895f7151a9aead6724ce2df95f9586;hp=e979da3e6586b56b98a9d18b47b34cd0cfa21306;hpb=68fcc90d8e95f1efe0efe07b2f59e5fab2d8c535;p=freeside.git diff --git a/rt/share/html/m/ticket/show b/rt/share/html/m/ticket/show index e979da3e6..4d60043e0 100644 --- a/rt/share/html/m/ticket/show +++ b/rt/share/html/m/ticket/show @@ -1,3 +1,50 @@ +%# BEGIN BPS TAGGED BLOCK {{{ +%# +%# COPYRIGHT: +%# +%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC +%# +%# +%# (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 @@ -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'); @@ -22,14 +69,10 @@ if ($ARGS{'id'} eq 'new') { Abort('You have no permission to create tickets in that queue.'); } - ($Ticket, @Actions) = CreateTicket( - Attachments => delete $session{'Attachments'}, - %ARGS, - ); + ($Ticket, @Actions) = CreateTicket( %ARGS ); unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) { Abort("No permission to view newly created ticket #".$Ticket->id."."); } - # }}} } else { $Ticket ||= LoadTicket($ARGS{'id'}); @@ -37,7 +80,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); @@ -49,14 +92,12 @@ if ($ARGS{'id'} eq 'new') { ARGSRef => \%ARGS, Actions => \@Actions); - $ARGS{UpdateAttachments} = $session{'Attachments'}; push @Actions, ProcessUpdateMessage( ARGSRef => \%ARGS, Actions => \@Actions, TicketObj => $Ticket, ); - delete $session{'Attachments'}; #Process status updates push @Actions, ProcessTicketWatchers(ARGSRef => \%ARGS, TicketObj => $Ticket ); @@ -64,11 +105,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( @@ -103,7 +147,7 @@ if (@Actions) { # If we haven't been passed in an Attachments object (through the precaching mechanism) # then we need to find one -my $Attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket); +my $Attachments = $Ticket->Attachments; my %documents; while ( my $attach = $Attachments->Next() ) { @@ -111,12 +155,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', @@ -129,7 +167,7 @@ my $print_value = sub { my $linked = $value->LinkValueTo; if ( defined $linked && length $linked ) { my $linked = $m->interp->apply_escapes( $linked, 'h' ); - $m->out(''); + $m->out(''); } my $comp = "ShowCustomField". $cf->Type; $m->callback( @@ -145,23 +183,23 @@ my $print_value = sub { } $m->out('') if defined $linked && length $linked; - # This section automatically populates a
IncludeContentForValue ) { my $vid = $value->id; $m->out( '\n} ); - $m->out( qq{\n} ); + $m->out( qq{\n} ); } }; -<&| /m/_elements/wrapper, title => $Ticket->Subject &> +<&| /m/_elements/wrapper, title => loc("#[_1]: [_2]", $Ticket->Id, $Ticket->Subject || '') &>
<& /m/_elements/ticket_menu, ticket => $Ticket &> @@ -204,9 +242,13 @@ my $print_value = sub {
<&|/l&>Queue:
<& /Ticket/Elements/ShowQueue, QueueObj => $Ticket->QueueObj &>
+
+
<&|/l&>Bookmark:
+
<& /Ticket/Elements/Bookmark, id => $Ticket->id &>
+
-% if ($Ticket->CustomFields->First) { +% if ($CustomFields->Count) { <&| /Widgets/TitleBox, title => loc('Custom Fields'), class => 'ticket-info-cfs', &> @@ -242,20 +284,20 @@ my $print_value = sub {
<&|/l&>Owner:
-
<& /Elements/ShowUser, User => $Ticket->OwnerObj, Ticket => $Ticket &> +
<& /Elements/ShowUser, User => $Ticket->OwnerObj, Ticket => $Ticket, Link => 0 &>
<&|/l&>Requestors:
-
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Requestors, Ticket => $Ticket &>
+
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Requestors, Ticket => $Ticket, Link => 0 &>
<&|/l&>Cc:
-
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Cc, Ticket => $Ticket &>
+
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->Cc, Ticket => $Ticket, Link => 0 &>
<&|/l&>AdminCc:
-
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->AdminCc, Ticket => $Ticket &>
+
<& /Ticket/Elements/ShowGroupMembers, Group => $Ticket->AdminCc, Ticket => $Ticket, Link => 0 &>
@@ -271,34 +313,10 @@ my $print_value = sub { <%$key%>
    % foreach my $rev (@{$documents{$key}}) { - -<%PERL> -my $size = $rev->ContentLength; - -if ($size) { - my $kb = int($size/102.4) / 10; - my $units = RT->Config->Get('AttachmentUnits'); - - if (!defined($units)) { - if ($size > 1024) { - $size = $kb . "k"; - } - else { - $size = $size . "b"; - } - } - elsif ($units eq 'k') { - $size = $kb . "k"; - } - else { - $size = $size . "b"; - } - - - +% if ($rev->ContentLength) {
  • - -<&|/l, $rev->CreatedAsString, $size, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3] + +<&|/l, $rev->CreatedAsString, $rev->FriendlyContentLength, $rev->CreatorObj->Name &>[_1] ([_2]) by [_3]
  • % } @@ -323,19 +341,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; -
    <% $resolver->AsString |n%> -
    -% } #foreach - -% } # if @customers - - <&| /Widgets/TitleBox, title => loc("Dates"), class => 'ticket-info-dates', &> @@ -360,7 +365,7 @@ if ($size) {
    <&|/l&>Due:
    % my $due = $Ticket->DueObj; -% if ( $due && $due->Unix > 0 && $due->Diff < 0 ) { +% if ( $due && $due->IsSet && $due->Diff < 0 && $Ticket->QueueObj->IsActiveStatus($Ticket->Status) ) {
    <% $due->AsString %>
    % } else {
    <% $due->AsString %>
    @@ -422,11 +427,11 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
    <% loc('Parents') %>:
    -
    <& /Ticket/Elements/ShowParents, Ticket => $Ticket &>
    +
    <& /Elements/ShowLinksOfType, Object => $Ticket, Type => 'MemberOf' &>
    <% loc('Children')%>:
    -
    <& /Ticket/Elements/ShowMembers, Ticket => $Ticket &>
    +
    <& /Elements/ShowLinksOfType, Object => $Ticket, Type => 'Members' &>
    <% loc('Refers to')%>:
    @@ -443,7 +448,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
      % while (my $Link = $Ticket->ReferredToBy->Next) { -% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->Type eq 'reminder'); +% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket') && $Link->BaseObj->__Value('Type') eq 'reminder');
    • <& /Elements/ShowLink, URI => $Link->BaseURI &>
    • % }