+ ( $Ticket, @results ) =
+ CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' );
+
+ 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] ) ) {
+ $m->comp( 'Error.html',
+ Why => loc( "Couldn't load ticket '[_1]'", $id ) );
+ $m->abort();
+ }
+
+ my ( $code, $msg );
+
+ #Update the status
+ if ( ( defined $ARGS{'Status'} )
+ and $ARGS{'Status'}
+ and ( $ARGS{'Status'} ne $Ticket->Status ) )
+ {
+ ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} );
+ push @results, "$msg";
+ }