[Rt-commit] rt branch, 4.2/date-is-null, created. rt-4.2.1-63-g00903d8

Alex Vandiver alexmv at bestpractical.com
Tue Dec 24 12:26:59 EST 2013


The branch, 4.2/date-is-null has been created
        at  00903d89dd37d4f01761f6a8a8f1d2b6b0304978 (commit)

- Log -----------------------------------------------------------------
commit b874550cc4d09afe9960f100bc57ae398d646798
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 24 12:21:25 2013 -0500

    Allow searching for dates which are unset
    
    e60885aa changed the meaning of "Starts < 'today'" (and all other date
    limits) to no longer include tickets whose dates are unset.  This
    behavior change also made it imposible to search for such tickets, as
    "Starts = '1970-01-01'" would also no longer find them, and the more
    straightforward "Starts IS NULL" was invalid.
    
    Allow IS NULL and IS NOT NULL searches on date ranges.

diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 0f3308e..8888059 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -553,12 +553,22 @@ sub _DateLimit {
     my ( $sb, $field, $op, $value, %rest ) = @_;
 
     die "Invalid Date Op: $op"
-        unless $op =~ /^(=|>|<|>=|<=)$/;
+        unless $op =~ /^(=|>|<|>=|<=|IS(\s+NOT)?)$/i;
 
     my $meta = $FIELD_METADATA{$field};
     die "Incorrect Meta Data for $field"
         unless ( defined $meta->[1] );
 
+    if ( $op =~ /^(IS(\s+NOT)?)$/i) {
+        return $sb->Limit(
+            FUNCTION => $sb->NotSetDateToNullFunction,
+            FIELD    => $meta->[1],
+            OPERATOR => $op,
+            VALUE    => "NULL",
+            %rest,
+        );
+    }
+
     if ( my $subkey = $rest{SUBKEY} ) {
         if ( $subkey eq 'DayOfWeek' && $op !~ /IS/i && $value =~ /[^0-9]/ ) {
             for ( my $i = 0; $i < @RT::Date::DAYS_OF_WEEK; $i++ ) {

commit 00903d89dd37d4f01761f6a8a8f1d2b6b0304978
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 24 12:26:43 2013 -0500

    Add an UPGRADING note about the changed meaning of < in date limits

diff --git a/docs/UPGRADING-4.2 b/docs/UPGRADING-4.2
index 0e458fa..dd21c25 100644
--- a/docs/UPGRADING-4.2
+++ b/docs/UPGRADING-4.2
@@ -300,6 +300,14 @@ on C<configure> enabling these in F<RT_Config.pm> implicitly will need
 to pass C<--enable-gpg> to C<configure>, or alter their
 C<RT_SiteConfig.pm> to enable the functionality explicitly.
 
+=item *
+
+In TicketSQL, "Starts = '1970-01-01'" will no longer find tickets with
+no Starts date set.  Instead, use "Starts IS NULL".  As a direct
+consequence, "Starts < 'today'" will no longer also find tickets with no
+Starts date; use "Starts < 'today' OR Starts IS NULL" to have the
+equivalent results in RT 4.2.
+
 =back
 
 =cut

-----------------------------------------------------------------------


More information about the rt-commit mailing list