X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FTicket%2FModifyAll.html;h=ad9b0bea1e904b4d1364f62fabdbbc0510f1aa2d;hp=4ed3934518c5c420521a200cc154dbdde0e075bc;hb=187086c479a09629b7d180eec513fb7657f4e291;hpb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7 diff --git a/rt/share/html/Ticket/ModifyAll.html b/rt/share/html/Ticket/ModifyAll.html index 4ed393451..ad9b0bea1 100755 --- a/rt/share/html/Ticket/ModifyAll.html +++ b/rt/share/html/Ticket/ModifyAll.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -53,15 +53,18 @@
% $m->callback( CallbackName => 'FormStart', ARGSRef => \%ARGS ); + + <&| /Widgets/TitleBox, title => loc('Modify ticket # [_1]', $Ticket->Id), class=>'ticket-info-basics' &> -<& Elements/EditBasics, TicketObj => $Ticket &> -<& Elements/EditCustomFields, TicketObj => $Ticket &> +<& Elements/EditBasics, TicketObj => $Ticket, defaults => \%ARGS &> +<& /Elements/EditCustomFields, Object => $Ticket, Grouping => 'Basics' &> % $m->callback(CallbackName => 'AfterBasics', Ticket => $Ticket); -
+ +<& /Elements/EditCustomFieldCustomGroupings, Object => $Ticket &> <&| /Widgets/TitleBox, title => loc('Dates'), class=>'ticket-info-dates'&> <& Elements/EditDates, TicketObj => $Ticket &> @@ -77,7 +80,13 @@
<&| /Widgets/TitleBox, title => loc('Links'), class=>'ticket-info-links' &> -<& /Elements/EditLinks, Object => $Ticket, Merge => 1 &> +<& /Elements/EditLinks, Object => $Ticket &> + + +
+ +<&| /Widgets/TitleBox, title => loc('Merge'), class=>'ticket-info-merge' &> +<& Elements/EditMerge, Ticket => $Ticket, %ARGS &>
@@ -87,7 +96,7 @@ <&|/l&>Update Type: - % if ($CanComment) { % } @@ -105,14 +114,15 @@ - <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $Ticket &> + <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, TicketObj => $Ticket, KeepValue => 1, &> <& /Ticket/Elements/AddAttachments, %ARGS, TicketObj => $Ticket &> <&|/l&>Content: - -% if (defined $ARGS{UpdateContent} && length($ARGS{UpdateContent} && !grep { /Message recorded/ } @results )) { + +% $m->callback( %ARGS, CallbackName => 'BeforeMessageBox' ); +% if (defined $ARGS{UpdateContent} && length($ARGS{UpdateContent})) { <& /Elements/MessageBox, Name=>"UpdateContent", Default=>$ARGS{UpdateContent}, IncludeSignature => 0 &> % } else { <& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &> @@ -128,6 +138,8 @@ Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
+% $m->callback(CallbackName => 'AfterForm', ARGSRef => \%ARGS, Ticket => $Ticket); + <%INIT> @@ -135,13 +147,6 @@ my $Ticket = LoadTicket($id); my $CustomFields = $Ticket->CustomFields; -# call this to show up hints of valid cf values. -$m->comp( - '/Elements/ValidateCustomFields', - CustomFields => $CustomFields, - ARGSRef => {}, -); - my $CanRespond = 0; my $CanComment = 0; @@ -152,74 +157,64 @@ $CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or $CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or $Ticket->CurrentUserHasRight('ModifyTicket') ); -# deal with deleting uploaded attachments -foreach my $key (keys %ARGS) { - if ($key =~ m/^DeleteAttach-(.+)$/) { - delete $session{'Attachments'}{$1}; - } - $session{'Attachments'} = { %{$session{'Attachments'} || {}} }; -} +ProcessAttachments(ARGSRef => \%ARGS); -# store the uploaded attachment in session -if ( defined $ARGS{'Attach'} && length $ARGS{'Attach'} ) { # attachment? - my $attachment = MakeMIMEEntity( - AttachmentFieldName => 'Attach' +my @results; +my $skip_update = 0; +$m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS, skip_update => \$skip_update, results => \@results ); + +{ + my ($status, @msg) = $m->comp( + '/Elements/ValidateCustomFields', + Object => $Ticket, + CustomFields => $CustomFields, + ARGSRef => \%ARGS, ); - - my $file_path = Encode::decode_utf8("$ARGS{'Attach'}"); - $session{'Attachments'} = { - %{$session{'Attachments'} || {}}, - $file_path => $attachment, - }; -} - -# delete temporary storage entry to make WebUI clean -unless (keys %{$session{'Attachments'}} and $ARGS{'UpdateAttach'}) { - delete $session{'Attachments'}; + unless ($status) { + push @results, @msg; + $skip_update = 1; + } } - -$m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS ); -my @results; - -unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) { - # There might be two owners. - if ( ref ($ARGS{'Owner'} )) { - my @owners =@{$ARGS{'Owner'}}; - delete $ARGS{'Owner'}; - foreach my $owner(@owners){ - if (defined($owner) && $owner =~ /\D/) { - $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->Name eq $owner); - } - elsif (length $owner) { - $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner); - } +# There might be two owners. +if ( ref ($ARGS{'Owner'} )) { + my @owners =@{$ARGS{'Owner'}}; + delete $ARGS{'Owner'}; + foreach my $owner(@owners){ + if (defined($owner) && $owner =~ /\D/) { + $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->Name eq $owner); + } + elsif (length $owner) { + $ARGS{'Owner'} = $owner unless ($Ticket->OwnerObj->id == $owner); } - } +} +unless ($skip_update or $OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} ) { push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS); push @results, ProcessObjectCustomFieldUpdates( Object => $Ticket, ARGSRef => \%ARGS); push @results, ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS); - - # Add session attachments if any to be processed by ProcessUpdateMessage - $ARGS{'UpdateAttachments'} = $session{'Attachments'} if ( $session{'Attachments'} ); push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS ); - # Cleanup WebUI - delete $session{'Attachments'}; - push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS ); push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS); -} push @results, ProcessTicketStatus( TicketObj => $Ticket, ARGSRef => \%ARGS ); -$Ticket->ApplyTransactionBatch; + $Ticket->ApplyTransactionBatch; -# If they've gone and moved the ticket to somewhere they can't see, etc... -# TODO: display the results, even if we can't display the ticket. + MaybeRedirectForResults( + Actions => \@results, + Path => "/Ticket/ModifyAll.html", + Arguments => { id => $Ticket->id }, + ); +} +# If they've gone and moved the ticket to somewhere they can't see, etc... unless ($Ticket->CurrentUserHasRight('ShowTicket')) { - Abort("No permission to view ticket"); + if (@results) { + Abort("A change was applied successfully, but you no longer have permissions to view the ticket", Actions => \@results); + } else { + Abort("No permission to view ticket"); + } }