[Rt-commit] r5217 - in rt/branches/3.4-RELEASE/lib: t/regression
ruz at bestpractical.com
ruz at bestpractical.com
Fri May 12 17:02:55 EDT 2006
Author: ruz
Date: Fri May 12 17:02:54 2006
New Revision: 5217
Modified:
rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm
rt/branches/3.4-RELEASE/lib/t/regression/22search_tix_by_txn.t
Log:
* use SetToMidnight( Timezone => 'server' ) to calc start and end of the day
Modified: rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm
==============================================================================
--- rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm (original)
+++ rt/branches/3.4-RELEASE/lib/RT/Tickets_Overlay.pm Fri May 12 17:02:54 2006
@@ -450,11 +450,8 @@
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 "=" ) {
@@ -462,10 +459,10 @@
# 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;
@@ -488,11 +485,10 @@
}
else {
- $value = strftime( "%Y-%m-%d %H:%M", gmtime($time) );
$sb->_SQLLimit(
FIELD => $meta->[1],
OPERATOR => $op,
- VALUE => $value,
+ VALUE => $date->ISO,
@rest,
);
}
@@ -545,7 +541,6 @@
my $date = RT::Date->new( $sb->CurrentUser );
$date->Set( Format => 'unknown', Value => $value );
- my $time = $date->Unix;
$sb->_OpenParen;
if ( $op eq "=" ) {
@@ -554,10 +549,10 @@
# 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},
@@ -587,7 +582,7 @@
ALIAS => $sb->{_sql_transalias},
FIELD => 'Created',
OPERATOR => $op,
- VALUE => $value,
+ VALUE => $date->ISO,
CASESENSITIVE => 0,
@rest
);
Modified: rt/branches/3.4-RELEASE/lib/t/regression/22search_tix_by_txn.t
==============================================================================
--- rt/branches/3.4-RELEASE/lib/t/regression/22search_tix_by_txn.t (original)
+++ rt/branches/3.4-RELEASE/lib/t/regression/22search_tix_by_txn.t Fri May 12 17:02:54 2006
@@ -1,6 +1,13 @@
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
#use Test::More tests => 26;
use Test::More qw/no_plan/;
+
$ENV{'TZ'} = 'GMT';
+
use RT;
RT::LoadConfig();
RT::Init();
@@ -29,4 +36,5 @@
$tix->FromSQL(qq{Updated = "2005-08-05" AND Subject = "$SUBJECT"});
is( $tix->Count, 1);
-1;
+
+exit 0;
More information about the Rt-commit
mailing list