Hi!

I've had to make some small changes to a few files in order to make
things run smoothly in our environment.  Take'em if you want'em. :-)

* Use Days_in_Month instead of assuming all months have 31 days.  I
  don't know about MySQL/PostgreSQL, but Oracle objects to dates like
  2004-11-31:

Index: Kernel/System/Stats/TicketOverview.pm
===================================================================
--- Kernel/System/Stats/TicketOverview.pm	(revision 92)
+++ Kernel/System/Stats/TicketOverview.pm	(working copy)
@@ -120,7 +120,7 @@
         StartDay => 1,
         StopYear => $Param{Year},
         StopMonth => => $Param{Month},
-        StopDay => 31,
+        StopDay => Days_in_Month($Param{Year}, $Param{Month}),
     );
     my %Queue = ();
     my @HeadData = ('Queue');
Index: Kernel/System/Stats/NewTickets.pm
===================================================================
--- Kernel/System/Stats/NewTickets.pm	(revision 92)
+++ Kernel/System/Stats/NewTickets.pm	(working copy)
@@ -120,7 +120,7 @@
         StartDay => 1,
         StopYear => $Param{Year},
         StopMonth => => $Param{Month},
-        StopDay => 31,
+        StopDay => Days_in_Month($Param{Year}, $Param{Month}),
     );
     my %Queue = ();
     my @HeadData = ('Queue');
* Typo ("History")

* Don't call TicketGet on undef TicketID's:

Index: Kernel/System/Ticket.pm
===================================================================
--- Kernel/System/Ticket.pm	(revision 92)
+++ Kernel/System/Ticket.pm	(revision 96)
@@ -2875,12 +2875,14 @@
         $Ticket{QueueID} = $Row[6] || '';
     }
     if (!%Ticket) {
-        $Self->{LogObject}->Log(Priority => 'notice', Message => "No such TicketID in Ticket Hisorry till '$Param{StopYear}-$Param{StopMonth}-$Param{StopDay} 23:59:59' ($Param{TicketID})!");
+        $Self->{LogObject}->Log(Priority => 'notice', Message => "No such TicketID in Ticket History till '$Param{StopYear}-$Param{StopMonth}-$Param{StopDay} 23:59:59' ($Param{TicketID})!");
         return;
     }
     else {
-        # update old ticket info
-#        if ($Ticket{TicketVersion} eq '1.1') {
+	# The match chain above doesnt match all kinds of history,
+	# which means we wont always have a TicketID.  Dont bother the
+	# database if we know we wont get an answer.
+       	if (defined $Ticket{TicketID}) {
             my %CurrentTicketData = $Self->TicketGet(TicketID => $Ticket{TicketID});
             foreach (qw(State Priority Queue TicketNumber)) {
                 if (!$Ticket{$_}) {
@@ -2896,7 +2898,7 @@
             if (!$Self->{StateObject}->StateGet(Name => $Ticket{State}, Cache => 1)) {
                 $Ticket{State} = $CurrentTicketData{State};
             }
-#        }
+        }
         # check if we should cache this ticket data
         my ($Sec, $Min, $Hour, $Day, $Month, $Year, $WDay) = $Self->{TimeObject}->SystemTime2Date(
             SystemTime => $Self->{TimeObject}->SystemTime(),
Regards,
-- 
Kristoffer.
_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev

Reply via email to