starting to work...
[freeside.git] / rt / share / html / SelfService / Display.html
index 4f227b1..23c7467 100755 (executable)
@@ -2,7 +2,7 @@
 %#
 %# COPYRIGHT:
 %#
-%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
 %#                                          <sales@bestpractical.com>
 %#
 %# (Except where explicitly superseded by other copyright notices)
@@ -74,7 +74,6 @@
 
 
 
-%#!!pape: selfservice_find_attachments.patch {{
 <& /Ticket/Elements/ShowHistory, 
       Ticket => $Ticket, 
       URIFile => "Display.html", 
@@ -84,7 +83,6 @@
       Attachments => $attachments, 
       UpdatePath => "Update.html" 
 &>
-%#!!pape: selfservice_find_attachments.patch }}
 
 
 
@@ -94,16 +92,16 @@ 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'} );
+my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
 
 # store the uploaded attachment in session
-if ( $ARGS{'Attach'} ) {    # attachment?
+if ( defined $ARGS{'Attach'} && length $ARGS{'Attach'} ) { # attachment?
     $session{'Attachments'} = {} unless defined $session{'Attachments'};
 
     my $attachment = MakeMIMEEntity(
@@ -121,7 +119,7 @@ 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 +134,19 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) {
 
 
     ( $Ticket, @results ) =
-    CreateTicket( Attachments => $session{'Attachments'}, %ARGS, Status => 'new' );
+    CreateTicket( Attachments => $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] ) ) {
@@ -186,7 +182,6 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) {
     my @cfupdates = ProcessObjectCustomFieldUpdates(Object => $Ticket, ARGSRef => \%ARGS);
     push (@results, @cfupdates);
 
-    # }}}
 
     #Update the status
     if (    ( defined $ARGS{'Status'} )
@@ -196,7 +191,6 @@ if ( defined ($id[0]) && $id[0] eq 'new' ) {
         ( $code, $msg ) = $Ticket->SetStatus( $ARGS{'Status'} );
         push @results, "$msg";
     }
-    # }}}
 
 
     }