X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FSelfService%2FDisplay.html;h=9f51e3359f3dbad581bdea1c7cedc616bc251d2e;hp=4f227b18a60e2b4df5b7551e7c61e445d21ecdd2;hb=e9e0cf0989259b94d9758eceff448666a2e5a5cc;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c diff --git a/rt/share/html/SelfService/Display.html b/rt/share/html/SelfService/Display.html index 4f227b18a..9f51e3359 100755 --- a/rt/share/html/SelfService/Display.html +++ b/rt/share/html/SelfService/Display.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -50,6 +50,7 @@ % $m->callback(CallbackName => 'BeforeActionList', %ARGS, Actions => \@results, ARGSRef => \%ARGS, Ticket => $Ticket ); <& /Elements/ListActions, actions => \@results &> +<& /Ticket/Elements/ShowUpdateStatus, Ticket => $Ticket &> @@ -74,7 +75,6 @@ -%#!!pape: selfservice_find_attachments.patch {{ <& /Ticket/Elements/ShowHistory, Ticket => $Ticket, URIFile => "Display.html", @@ -84,7 +84,6 @@ Attachments => $attachments, UpdatePath => "Update.html" &> -%#!!pape: selfservice_find_attachments.patch }} @@ -94,34 +93,19 @@ my ( $field, @results ); $m->callback( ARGSRef => \%ARGS, CallbackName => 'Initial' ); -# {{{ Load the ticket +# Load the ticket #If we get handed two ids, mason will make them an array. bleck. # We want teh first one. Just because there's no other sensible way # to deal my @id = ( ref $id eq 'ARRAY' ) ? @{$id} : ($id); -my $Ticket = new RT::Ticket( $session{'CurrentUser'} ); - -# store the uploaded attachment in session -if ( $ARGS{'Attach'} ) { # attachment? - $session{'Attachments'} = {} unless defined $session{'Attachments'}; - - my $attachment = MakeMIMEEntity( - AttachmentFieldName => 'Attach' - ); - - my $file_path = Encode::decode_utf8("$ARGS{'Attach'}"); - $session{'Attachments'} = { - %{ $session{'Attachments'} || {} }, - $file_path => $attachment, - }; -} +my $Ticket = RT::Ticket->new( $session{'CurrentUser'} ); if ( defined ($id[0]) && $id[0] eq 'new' ) { # {{{ Create a new ticket - my $Queue = new RT::Queue( $session{'CurrentUser'} ); + my $Queue = RT::Queue->new( $session{'CurrentUser'} ); unless ( $Queue->Load( $ARGS{'Queue'} ) ) { $m->comp( 'Error.html', Why => loc('Queue not found') ); $m->abort; @@ -136,21 +120,12 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) { ( $Ticket, @results ) = - CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' ); + CreateTicket( Attachments => delete $session{'Attachments'}, %ARGS ); unless ( $Ticket->id ) { $m->comp( 'Error.html', Why => join( "\n", @results )); $m->abort(); } - - # }}} - - # delete temporary storage entry to make WebUI clean - unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) { - delete $session{'Attachments'}; - } - - # }}} } else { unless ( $Ticket->Load( $id[0] ) ) { @@ -176,17 +151,11 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) { ARGSRef => \%ARGS, TicketObj => $Ticket ); - delete $session{'Attachments'}; - - # delete temporary storage entry to make WebUI clean - unless ( keys %{ $session{'Attachments'} } and $ARGS{'UpdateAttach'} ) { - delete $session{'Attachments'}; - } + delete $session{'Attachments'}; my @cfupdates = ProcessObjectCustomFieldUpdates(Object => $Ticket, ARGSRef => \%ARGS); push (@results, @cfupdates); - # }}} #Update the status if ( ( defined $ARGS{'Status'} ) @@ -196,7 +165,6 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) { ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} ); push @results, "$msg"; } - # }}} } @@ -210,16 +178,22 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) { $m->abort(); } - if (@results) { - # We've done something, so we need to clear the decks to avoid - # resubmission on refresh. - # But we need to store Actions somewhere too, so we don't lose them. - my $key = Digest::MD5::md5_hex(rand(1024)); - push @{ $session{"Actions"}->{$key} ||= [] }, @results; - $session{'i'}++; - RT::Interface::Web::Redirect( RT->Config->Get('WebURL') ."SelfService/Display.html?id=". $Ticket->id."&results=".$key); + if ( $ARGS{'MarkAsSeen'} ) { + $Ticket->SetAttribute( + Name => 'User-'. $Ticket->CurrentUser->id .'-SeenUpTo', + Content => $Ticket->LastUpdated, + ); + push @results, loc('Marked all messages as seen'); } + # This code does automatic redirection if any updates happen. + MaybeRedirectForResults( + Actions => \@results, + Path => '/SelfService/Display.html', + Anchor => $ARGS{'Anchor'}, + Arguments => { id => $Ticket->id }, + ); + my $Transactions = $Ticket->Transactions; my $attachments =