X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FTicket%2FCreate.html;h=bd60b5c98585361dc9e51476bec66839d5f8de07;hb=ed1f84b4e8f626245995ecda5afcf83092c153b2;hp=6ea2c9f39a3ade21d61b6c64ad313d2e972c39d3;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924;p=freeside.git diff --git a/rt/share/html/Ticket/Create.html b/rt/share/html/Ticket/Create.html index 6ea2c9f39..bd60b5c98 100755 --- a/rt/share/html/Ticket/Create.html +++ b/rt/share/html/Ticket/Create.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) @@ -47,51 +47,80 @@ %# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => $title, - onload => "function () { hide(document.getElementById('Ticket-Create-details')) }" &> -<& /Elements/Tabs, - current_toptab => "Ticket/Create.html", - Title => $title, - actions => $actions &> + onload => "function () { hide('Ticket-Create-details') }" &> +<& /Elements/Tabs &> + <& /Elements/ListActions, actions => \@results &> +
- + + % $m->callback( CallbackName => 'FormStart', QueueObj => $QueueObj, ARGSRef => \%ARGS ); + % if ($gnupg_widget) { -<& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &> + <& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &> % } +
-<&| /Widgets/TitleBox, title => $title &> - - -%# - - - - + +
+ <&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &> +
<&|/l&>Queue:<& Elements/ShowQueue, QueueObj => $QueueObj &> -%# -<& /Elements/SelectQueue, - Name => 'Queue', - Default => $QueueObj->Name, - ShowNullOption => 0, - ShowAllQueues => 0, - OnChange => "document.getElementsByName('id')[0].value = ''; form.submit()" &> -<&|/l&>Status: - -<& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0, SkipDeleted => 1 &> - -<&|/l&>Owner: - -<& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$RT::Nobody->Id, DefaultValue => 0 &> -
+ <& /Ticket/Elements/EditBasics, + InTable => 1, + fields => [ + { name => 'Queue', + comp => '/Elements/SelectQueue', + args => { + Name => 'Queue', + Default => $QueueObj->Name, + QueueObj => $QueueObj, + ShowNullOption => 0, + ShowAllQueues => 0, + OnChange => "document.getElementsByName('id')[0].value = 'refresh'; form.submit()", + }, + }, + { name => 'Status', + comp => '/Elements/SelectStatus', + args => { + Name => "Status", + Default => $ARGS{Status} || $QueueObj->Lifecycle->DefaultOnCreate, + DefaultValue => 0, + SkipDeleted => 1, + QueueObj => $QueueObj, + }, + }, + { name => 'Owner', + comp => '/Elements/SelectOwner', + args => { + Name => "Owner", + Default => $ARGS{Owner} || RT->Nobody->Id, + DefaultValue => 0, + QueueObj => $QueueObj, + }, + } + ] + &> + % $m->callback( CallbackName => 'AfterOwner', ARGSRef => \%ARGS ); - + + <& /Ticket/Elements/EditCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1, KeepValue => 1 &> + <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1, KeepValue => 1 &> +
+ +% $m->callback( CallbackName => 'AfterBasics', QueueObj => $QueueObj, ARGSRef => \%ARGS ); +
+ +
+ <&| /Widgets/TitleBox, title => $title, class => 'messagedetails' &> + @@ -99,55 +128,41 @@ - - + + - - - + + + - + + - - -<& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj &> - -% if (exists $session{'Attachments'}) { - - + + + -% } # end of if @@ -160,6 +175,9 @@ -
<&|/l&>Requestors: -<& /Elements/EmailInput, Name => 'Requestors', Size => '40', Default => $ARGS{Requestors} || $session{CurrentUser}->EmailAddress &> +<& /Elements/EmailInput, Name => 'Requestors', Size => undef, Default => exists($ARGS{Requestors}) ? $ARGS{Requestors} : $session{CurrentUser}->EmailAddress &> % $m->callback( CallbackName => 'AfterRequestors', QueueObj => $QueueObj, ARGSRef => \%ARGS );
<&|/l&>Cc: <& /Elements/EmailInput, Name => 'Cc', Size => '40', Default => $ARGS{Cc} &> -<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.) -<& /Elements/EmailInput, Name => 'Cc', Size => undef, Default => $ARGS{Cc} &>
-<&|/l&>Admin Cc: -<& /Elements/EmailInput, Name => 'AdminCc', Size => '40', Default => $ARGS{AdminCc} &> -<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.) -  + + <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.) + +
-<&|/l&>Subject: - - -% $m->callback( %ARGS, CallbackName => 'AfterSubject' ); +<&|/l&>Admin Cc: <& /Elements/EmailInput, Name => 'AdminCc', Size => undef, Default => $ARGS{AdminCc} &>
-<& /Ticket/Elements/EditCustomFields, %ARGS, QueueObj => $QueueObj &> -
-<&|/l&>Attached file: - -<&|/l&>Check box to delete
-% foreach my $attach_name (keys %{$session{'Attachments'}}) { -<%$attach_name%>
-% } # end of foreach -
  + + <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.) + +
-<&|/l&>Attach file: +<&|/l&>Subject: - - + +% $m->callback( %ARGS, CallbackName => 'AfterSubject' );
<&|/l&>Describe the issue below:
+% if ( RT->Config->Get('ArticleOnTicketCreate')) { +<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj &> +% } % $m->callback( %ARGS, QueueObj => $QueueObj, CallbackName => 'BeforeMessageBox' ); % if (exists $ARGS{Content}) { <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => 0 &> @@ -171,9 +189,12 @@
- -<& /Elements/Submit, Label => loc("Create")&> + + <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &> + + + <& /Elements/Submit, Label => loc("Create"), id => 'SubmitTicket' &> +
@@ -242,7 +263,6 @@ <&|/l&>Referred to by Customer ID -
@@ -258,10 +278,10 @@ <%INIT> $m->callback( CallbackName => "Init", ARGSRef => \%ARGS ); my $Queue = $ARGS{Queue}; +$session{DefaultQueue} = $Queue; -my $CloneTicketObj; if ($CloneTicket) { - $CloneTicketObj = RT::Ticket->new( $session{CurrentUser} ); + my $CloneTicketObj = RT::Ticket->new( $session{CurrentUser} ); $CloneTicketObj->Load($CloneTicket) or Abort( loc("Ticket could not be loaded") ); @@ -273,8 +293,8 @@ if ($CloneTicket) { }; $clone->{$_} = $CloneTicketObj->$_() - for qw/Owner Subject FinalPriority TimeEstimated TimeWorked - Status TimeLeft/; + for qw/Owner Subject FinalPriority Status/; + # not TimeWorked, TimeEstimated, or TimeLeft $clone->{$_} = $CloneTicketObj->$_->AsString for grep { $CloneTicketObj->$_->Unix } @@ -283,52 +303,48 @@ if ($CloneTicket) { my $members = $CloneTicketObj->Members; my ( @members, @members_of, @refers, @refers_by, @depends, @depends_by ); my $refers = $CloneTicketObj->RefersTo; + my $get_link_value = sub { + my ($link, $type) = @_; + my $uri_method = $type . 'URI'; + my $local_method = 'Local' . $type; + my $uri = $link->$uri_method; + return if $uri->IsLocal and + $uri->Object and + $uri->Object->isa('RT::Ticket') and + $uri->Object->Type eq 'reminder'; + + return $link->$local_method || $uri->URI; + }; while ( my $refer = $refers->Next ) { - push @refers, $refer->LocalTarget; + my $refer_value = $get_link_value->($refer, 'Target'); + push @refers, $refer_value if defined $refer_value; } $clone->{'new-RefersTo'} = join ' ', @refers; my $refers_by = $CloneTicketObj->ReferredToBy; while ( my $refer_by = $refers_by->Next ) { - push @refers_by, $refer_by->LocalBase; + my $refer_by_value = $get_link_value->($refer_by, 'Base'); + push @refers_by, $refer_by_value if defined $refer_by_value; } $clone->{'RefersTo-new'} = join ' ', @refers_by; - if (0) { # Temporarily disabled - my $depends = $CloneTicketObj->DependsOn; - while ( my $depend = $depends->Next ) { - push @depends, $depend->LocalTarget; - } - $clone->{'new-DependsOn'} = join ' ', @depends; - - my $depends_by = $CloneTicketObj->DependedOnBy; - while ( my $depend_by = $depends_by->Next ) { - push @depends_by, $depend_by->LocalBase; - } - $clone->{'DependsOn-new'} = join ' ', @depends_by; - - while ( my $member = $members->Next ) { - push @members, $member->LocalBase; - } - $clone->{'MemberOf-new'} = join ' ', @members; - - my $members_of = $CloneTicketObj->MemberOf; - while ( my $member_of = $members_of->Next ) { - push @members_of, $member_of->LocalTarget; - } - $clone->{'new-MemberOf'} = join ' ', @members_of; - - } my $cfs = $CloneTicketObj->QueueObj->TicketCustomFields(); while ( my $cf = $cfs->Next ) { + next if $cf->FirstAttribute('NoClone'); my $cf_id = $cf->id; my $cf_values = $CloneTicketObj->CustomFieldValues( $cf->id ); my @cf_values; while ( my $cf_value = $cf_values->Next ) { push @cf_values, $cf_value->Content; } - $clone->{"Object-RT::Ticket--CustomField-$cf_id-Value"} = join "\n", - @cf_values; + + if ( @cf_values > 1 && $cf->Type eq 'Select' ) { + $clone->{"Object-RT::Ticket--CustomField-$cf_id-Value"} = \@cf_values; + } + else { + $clone->{"Object-RT::Ticket--CustomField-$cf_id-Value"} = join "\n", + @cf_values; + } } # Pass customer links along (even though cloning of parent links @@ -351,7 +367,7 @@ my @results; my $title = loc("Create a new ticket"); -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded.")); $m->callback( QueueObj => $QueueObj, title => \$title, results => \@results, ARGSRef => \%ARGS ); @@ -366,33 +382,7 @@ my $ValidCFs = $m->comp( ARGSRef => \%ARGS ); -# {{{ deal with deleting uploaded attachments -foreach my $key (keys %ARGS) { - if ($key =~ m/^DeleteAttach-(.+)$/) { - delete $session{'Attachments'}{$1}; - } - $session{'Attachments'} = { %{$session{'Attachments'} || {}} }; -} -# }}} - -# {{{ store the uploaded attachment in session -if ($ARGS{'Attach'}) { # attachment? - my $attachment = MakeMIMEEntity( - AttachmentFieldName => 'Attach' - ); - - 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{'id'} eq 'new') { - delete $session{'Attachments'}; -} +ProcessAttachments(ARGSRef => \%ARGS); my $checks_failure = 0; @@ -432,6 +422,9 @@ my $skip_create = 0; $m->callback( CallbackName => 'BeforeCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, checks_failure => $checks_failure, results => \@results ); +$m->comp( '/Articles/Elements/CheckSkipCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, + checks_failure => $checks_failure, results => \@results ); + if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket? if ( $ValidCFs && !$checks_failure && !$skip_create ) { # CREATE THE TICKET. @@ -457,15 +450,8 @@ if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} e } } } - -my $actions = { - A => { - html => q[] . loc('Show basics') . q[], - }, - B => { - html => q[] . loc('Show details') . q[], - }, -}; +PageMenu->child( basics => raw_html => q[] . loc('Basics') . q[]); +PageMenu->child( details => raw_html => q[] . loc('Details') . q[]); <%ARGS>