[otrs-cvs] otrs/Kernel/System Ticket.pm,1.549.2.12,1.549.2.13

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/Kernel/System
In directory lancelot:/tmp/cvs-serv21012/Kernel/System

Modified Files:
      Tag: rel-3_1
	Ticket.pm 
Log Message:
Fixed bug#8936 - Ticket close date is empty when ticket is created in closed state.

Author: mb

Index: Ticket.pm
===================================================================
RCS file: /home/cvs/otrs/Kernel/System/Ticket.pm,v
retrieving revision 1.549.2.12
retrieving revision 1.549.2.13
diff -2 -u -d -r1.549.2.12 -r1.549.2.13
--- Ticket.pm	16 Oct 2012 12:35:20 -0000	1.549.2.12
+++ Ticket.pm	25 Nov 2012 19:49:48 -0000	1.549.2.13
@@ -1352,5 +1352,5 @@
     }
 
-    # get close time
+    # get close state types
     my @List = $Self->{StateObject}->StateGetStatesByType(
         StateType => ['closed'],
@@ -1359,13 +1359,19 @@
     return if !@List;
 
-    # Get id for StateUpdate;
-    my $HistoryTypeID = $Self->HistoryTypeLookup( Type => 'StateUpdate' );
-    return if !$HistoryTypeID;
+    # Get id for history types
+    my @HistoryTypeIDs;
+    for my $HistoryType (qw ( StateUpdate NewTicket )) {
+        push @HistoryTypeIDs, $Self->HistoryTypeLookup( Type => $HistoryType );
+    }
 
     return if !$Self->{DBObject}->Prepare(
-        SQL => "SELECT create_time FROM ticket_history WHERE ticket_id = ? AND "
-            . " state_id IN (${\(join ', ', sort @List)}) AND history_type_id = ? "
-            . " ORDER BY create_time DESC",
-        Bind => [ \$Param{TicketID}, \$HistoryTypeID ],
+        SQL => "
+            SELECT create_time
+            FROM ticket_history
+            WHERE ticket_id = ?
+               AND state_id IN (${\(join ', ', sort @List)})
+               AND history_type_id IN  (${\(join ', ', sort @HistoryTypeIDs)})
+            ORDER BY create_time DESC",
+        Bind  => [ \$Param{TicketID} ],
         Limit => 1,
     );
@@ -6230,5 +6236,5 @@
         next TICKETATTRIBUTE if
             ref $Checks{Ticket}->{$TicketAttribute} eq 'ARRAY'
-                && !IsArrayRefWithData( $Checks{Ticket}->{$TicketAttribute} );
+            && !IsArrayRefWithData( $Checks{Ticket}->{$TicketAttribute} );
 
         # compare if data is different and skip on same data
@@ -6253,5 +6259,5 @@
         next TICKETATTRIBUTE if
             ref $ChecksDatabase{Ticket}->{$TicketAttribute} eq 'ARRAY'
-                && !IsArrayRefWithData( $ChecksDatabase{Ticket}->{$TicketAttribute} );
+            && !IsArrayRefWithData( $ChecksDatabase{Ticket}->{$TicketAttribute} );
 
         $ChecksDatabase{DynamicField}->{$TicketAttribute}
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.