X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FTickets_Overlay.pm;h=16e98aec8253d37a1a5683219cc20279016663e9;hb=afc02cadca8e8033285bb213bcde620cb8fa4f99;hp=9450e4d4970f7c85529f1339c702b9679a6d2589;hpb=cb2e8053f44e7dae3d7016d2e4427a69b6600a4e;p=freeside.git diff --git a/rt/lib/RT/Tickets_Overlay.pm b/rt/lib/RT/Tickets_Overlay.pm index 9450e4d49..16e98aec8 100644 --- a/rt/lib/RT/Tickets_Overlay.pm +++ b/rt/lib/RT/Tickets_Overlay.pm @@ -539,11 +539,32 @@ sub _DateFieldLimit { # if we're specifying =, that means we want everything on a # particular single day. in the database, we need to check for > # and < the edges of that day. - - $date->SetToMidnight( Timezone => 'server' ); - my $daystart = $date->ISO; - $date->AddDay; - my $dayend = $date->ISO; + # + # Except if the value is 'this month' or 'last month', check + # > and < the edges of the month. + + my ($daystart, $dayend); + if ( lc($value) eq 'this month' ) { + $date->SetToNow; + $date->SetToStart('month', Timezone => 'server'); + $daystart = $date->ISO; + $date->AddMonth; + $dayend = $date->ISO; + } + elsif ( lc($value) eq 'last month' ) { + $date->SetToNow; + $date->SetToStart('month', Timezone => 'server'); + $dayend = $date->ISO; + $date->AddDays(-1); + $date->SetToStart('month', Timezone => 'server'); + $daystart = $date->ISO; + } + else { + $date->SetToMidnight( Timezone => 'server' ); + $daystart = $date->ISO; + $date->AddDay; + $dayend = $date->ISO; + } $sb->_OpenParen; @@ -1372,11 +1393,6 @@ sub _CustomFieldLimit { ($queue, $field, $cf, $column) = $self->_CustomFieldDecipher( $field ); $cfid = $cf ? $cf->id : 0 ; - # Handle date custom fields specially - if ( $cf->Type eq 'Date' ) { - return $self->_DateCustomFieldLimit($_field, $op, $value, %rest); - } - # If we're trying to find custom fields that don't match something, we # want tickets where the custom field has no value at all. Note that # we explicitly don't include the "IS NULL" case, since we would @@ -2811,11 +2827,6 @@ sub LimitCustomField { $args{CUSTOMFIELD} = $CF->Id; } - # Handle special customfields types - if ($CF->Type eq 'Date') { - $args{FIELD} = 'DateCustomFieldValue'; - } - #If we are looking to compare with a null value. if ( $args{'OPERATOR'} =~ /^is$/i ) { $args{'DESCRIPTION'}