[rt-devel] [PATCH] rt3 On Date never matches

Phil Crow philcrow2000 at yahoo.com
Wed Jul 16 10:29:48 EDT 2003


When users look for tickets resolved on a certain
date, their query doesn't match.  The date parser is
adding a time (midnight) to their search, so nothing
matches.  I corrected this for our site with the
following patch to Search/Listing.

The patch looks for date 'On' (a.k.a. =) queries, if
they don't specify a time, it replaces them with two
queries: one for after 00:00 and another for before
23:59 on the date specified.

Hope this helps others.

(If the patch is in the wrong format, please advise
me.)

--- rt-3-0-4/html/Search/Listing.html   2003-07-12
03:24:37.000000000 -0500
+++ L2.html     2003-07-16 09:20:38.000000000 -0500
@@ -98,7 +98,24 @@
            $session{'tickets'}->ClearRestrictions;
        }
 }
+# If the query is 'On' a specific date, but has no
time with it:
+if ($ARGS{DateOp} eq '=' and $ARGS{ValueOfDate} !~
/:/) {
+     # Make a new date only query for After midnight.
+     my %tmp_args;
+     $tmp_args{ValueOfDate} = "$ARGS{ValueOfDate}
00:00";
+     $tmp_args{DateOp}      = ">";
+     $tmp_args{DateType}    = $ARGS{DateType};
+     ProcessSearchQuery(ARGS=>\%tmp_args);
+
+     # Now change the actual date restriction to
before midnight.
+     # Then run it with all others.
+     $ARGS{ValueOfDate}     = "$ARGS{ValueOfDate}
23:59";
+     $ARGS{DateOp}          = "<";
+     ProcessSearchQuery(ARGS=>\%ARGS);
+}
+else {  # The query is not 'On' a specific date.
    ProcessSearchQuery(ARGS=>\%ARGS);
+}
    $session{'tickets'}->RedoSearch();
    if ( $session{'tickets'}->DescribeRestrictions())
{
        $ticketcount = $session{tickets}->CountAll();

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: on_date_never_matches.patch
Type: application/octet-stream
Size: 1087 bytes
Desc: on_date_never_matches.patch
Url : http://pallas.eruditorum.org/pipermail/rt-devel/attachments/20030716/cd964ff4/on_date_never_matches.obj


More information about the Rt-devel mailing list