or $op eq "!=";
my $meta = $FIELDS{$field};
- if ( defined $meta->[1] ) {
+ if ( defined $meta->[1] && defined $value && $value !~ /^\d+$/ ) {
my $class = "RT::" . $meta->[1];
my $o = $class->new( $sb->CurrentUser );
$o->Load($value);
die "Incorrect Meta Data for $field"
unless ( defined $meta->[1] );
- use POSIX 'strftime';
-
my $date = RT::Date->new( $sb->CurrentUser );
$date->Set( Format => 'unknown', Value => $value );
- my $time = $date->Unix;
if ( $op eq "=" ) {
# particular single day. in the database, we need to check for >
# and < the edges of that day.
- my $daystart = strftime( "%Y-%m-%d %H:%M",
- gmtime( $time - ( $time % 86400 ) ) );
- my $dayend = strftime( "%Y-%m-%d %H:%M",
- gmtime( $time + ( 86399 - $time % 86400 ) ) );
+ $date->SetToMidnight( Timezone => 'server' );
+ my $daystart = $date->ISO;
+ $date->AddDay;
+ my $dayend = $date->ISO;
$sb->_OpenParen;
}
else {
- $value = strftime( "%Y-%m-%d %H:%M", gmtime($time) );
$sb->_SQLLimit(
FIELD => $meta->[1],
OPERATOR => $op,
- VALUE => $value,
+ VALUE => $date->ISO,
@rest,
);
}
my $date = RT::Date->new( $sb->CurrentUser );
$date->Set( Format => 'unknown', Value => $value );
- my $time = $date->Unix;
$sb->_OpenParen;
if ( $op eq "=" ) {
# particular single day. in the database, we need to check for >
# and < the edges of that day.
- my $daystart = strftime( "%Y-%m-%d %H:%M",
- gmtime( $time - ( $time % 86400 ) ) );
- my $dayend = strftime( "%Y-%m-%d %H:%M",
- gmtime( $time + ( 86399 - $time % 86400 ) ) );
+ $date->SetToMidnight( Timezone => 'server' );
+ my $daystart = $date->ISO;
+ $date->AddDay;
+ my $dayend = $date->ISO;
$sb->_SQLLimit(
ALIAS => $sb->{_sql_transalias},
ALIAS => $sb->{_sql_transalias},
FIELD => 'Created',
OPERATOR => $op,
- VALUE => $value,
+ VALUE => $date->ISO,
CASESENSITIVE => 0,
@rest
);
# RT doesn't allow to add groups as members of the
# ticket roles, so we just hide entries in CGM table
# with MemberId == GroupId from results
- my $groupmembers = $self->SUPER::Limit(
+ $self->SUPER::Limit(
LEFTJOIN => $groupmembers,
FIELD => 'GroupId',
OPERATOR => '!=',
@_
);
- #TODO VALUE should also take queue names and queue objects
- #TODO FIXME why are we canonicalizing to name, not id, robrt?
- if ( $args{VALUE} =~ /^\d+$/ ) {
+ #TODO VALUE should also take queue objects
+ if ( defined $args{'VALUE'} && $args{'VALUE'} !~ /^\d+$/ ) {
my $queue = new RT::Queue( $self->CurrentUser );
$queue->Load( $args{'VALUE'} );
- $args{VALUE} = $queue->Name;
+ $args{'VALUE'} = $queue->Id;
}
# What if they pass in an Id? Check for isNum() and convert to
$self->Limit(
FIELD => 'Queue',
- VALUE => $args{VALUE},
+ VALUE => $args{'VALUE'},
OPERATOR => $args{'OPERATOR'},
DESCRIPTION => join(
- ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{VALUE},
+ ' ', $self->loc('Queue'), $args{'OPERATOR'}, $args{'VALUE'},
),
);