%# $Header: /raid/cvsroot/rt/webrt/Ticket/Display.html,v 1.2 2001/11/06 23:07:07 jesse Exp $ %# Copyright 1996-2000 Jesse Vincent <& /Elements/Header, Title => "Ticket #".$Ticket->Id ." ".$Ticket->Subject &> <& /Ticket/Elements/Tabs, Ticket => $Ticket, current_tab => 'Ticket/Display.html?id='.$Ticket->id &> <& /Elements/ListActions, actions => \@Actions &> <& /Ticket/Elements/ShowSummary, Ticket => $Ticket &>
<& /Ticket/Elements/ShowHistory , Ticket => $Ticket, Collapsed => $ARGS{'Collapsed'}, ShowHeaders => $ARGS{'ShowHeaders'} &> <%ARGS> $id => undef $Create => undef $ShowHeaders => undef $Collapsed => undef <%INIT> my ($linkid, $message, $tid, $Ticket, @Actions); $Ticket = new RT::Ticket($session{'CurrentUser'}); unless ($id) { Abort('No ticket specified'); } if ($ARGS{'id'} eq 'new') { # {{{ Create a new ticket my $Queue = new RT::Queue($session{'CurrentUser'}); unless ($Queue->Load($ARGS{'Queue'})) { Abort('Queue not found'); } unless ($Queue->CurrentUserHasRight('CreateTicket')) { Abort('You have no permission to create tickets in that queue.'); } my $due = new RT::Date($session{'CurrentUser'}); $due->Set(Format => 'unknown', Value => $ARGS{'Due'}); my $starts = new RT::Date($session{'CurrentUser'}); $starts->Set(Format => 'unknown', Value => $ARGS{'Starts'}); my @Requestors = split(/,/,$ARGS{'Requestors'}); my @Cc = split(/,/,$ARGS{'Cc'}); my @AdminCc = split(/,/,$ARGS{'AdminCc'}); my $MIMEObj = MakeMIMEEntity( Subject => $ARGS{'Subject'}, From => $ARGS{'From'}, Cc => $ARGS{'Cc'}, Body => $ARGS{'Content'}, AttachmentFieldName => 'Attach'); my %create_args = ( Queue=>$ARGS{Queue}, Owner=>$ARGS{ValueOfOwner}, InitialPriority=> $ARGS{InitialPriority}, FinalPriority=> $ARGS{FinalPriority}, TimeLeft => $ARGS{TimeLeft}, TimeWorked => $ARGS{TimeWorked}, Requestor=> \@Requestors, Cc => \@Cc, AdminCc => \@AdminCc, Subject=>$ARGS{Subject}, Status=>$ARGS{Status}, Due => $due->ISO, Starts => $starts->ISO, MIMEObj => $MIMEObj ); # we need to get any KeywordSelect- fields into %create_args.. grep { $_ =~ /^KeywordSelect-/ && {$create_args{$_} = $ARGS{$_}}} %ARGS; my ($id, $Trans, $ErrMsg)= $Ticket->Create(%create_args); unless ($id && $Trans) { Abort($ErrMsg); } my @linktypes = qw( DependsOn MemberOf RefersTo ); foreach my $linktype (@linktypes) { foreach my $luri (split (/ /,$ARGS{"new-$linktype"})) { $luri =~ s/\s*$//; # Strip trailing whitespace my ($val, $msg) = $Ticket->AddLink( Target => $luri, Type => $linktype); push @Actions, $msg; } foreach my $luri (split (/ /,$ARGS{"$linktype-new"})) { my ($val, $msg) = $Ticket->AddLink( Base => $luri, Type => $linktype); push @Actions, $msg; } } # don't try to change queue to the current queue delete $ARGS{'Queue'}; push(@Actions, $ErrMsg); unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view newly created ticket #".$Ticket->id."."); } # }}} } else { $Ticket = LoadTicket($ARGS{'id'}); unless ($Ticket->CurrentUserHasRight('ShowTicket')) { Abort("No permission to view ticket"); } if (defined $ARGS{'Action'}) { if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) { my $action = $1; my ($res, $msg)=$Ticket->$action(); push(@Actions, $msg); } } $ARGS{'UpdateContent'} =~ s/\r\n/\n/g; chomp ($ARGS{'UpdateContent'}) ; if ($ARGS{'UpdateContent'} && $ARGS{'UpdateContent'} ne '' && $ARGS{'UpdateContent'} ne "-- \n" . $session{'CurrentUser'}->UserObj->Signature ) { ProcessUpdateMessage(ARGSRef=>\%ARGS, Actions=>\@Actions, TicketObj=>$Ticket); } #Process status updates my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket); push (@Actions, @BasicActions); }