# 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;
($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
$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'}