Hi all,
I'm confused about the way OTRS makes datetime searches in dynamic fields.

I've created a ticket state called solved.
I've created an event that sets a dynamic field called TicketSolvedTime to the 
current time when state is set to 'solved'.
I want to search ticket solved MORE THAN 3 WEEKS ago (i.e. today is 2013/03/19, 
3 weeks ago is 2013/02/26 [EPOCH ~1361893827], I want tickets solved from the 
beginning of time until 2013/02/26). I've set the ticket 40063 as 
'DynamicField_TicketSolvedTime' => '2013-01-01 15:31:01' [EPOCH ~1357055427].
I've done the following script:

    for my $QueryWord (qw (GreaterThan SmallerThan)){
        my %Query = (
            Result          => 'ARRAY',
            UserID          => 1,
            DynamicField_TicketSolvedTime => {
                $QueryWord => $CommonObject{TimeObject}->SystemTime() - 
1814400, # 3 weeks ago, weeks to seconds
            },
        );

        # search tickets
        my @TicketIDs = $CommonObject{TicketObject}->TicketSearch(%Query);
        print "$QueryWord: " . Dumper(@TicketIDs);
    }

Which produces the following output:

    otrs@localhost:~$ SolvedTicket.pl
        GreaterThan: @TicketIDs = (
                       '40063'
                     );
        SmallerThan: @TicketIDs = ();

I KNOW than TicketSolvedTime is smaller than 3 weeks ago (EPOCH), so I would 
expect the script to retrieve the ticket when TicketSolvedTime is SmallerThan 3 
weeks ago. Instead, it retrieves the ticket when the condition is GreaterThan, 
which is not!

Could you kindly explain to me what I'm missing?

Kind regards,
Juan Clavero

OTRS 3.1 on CentOSLinux [Apache and MySQL ]
connected to an Active Directory for Agents and Customers.


_______________________________________________
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