diff options
author | Dave Arter <davea@mysociety.org> | 2014-05-21 10:13:53 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2014-05-29 14:54:11 +0100 |
commit | e3a1b774ac030ff00ff85f1965513b8b59568ace (patch) | |
tree | 4227e46745460c17d2af668225c64c31b3d97085 /bin | |
parent | 0c8ec1cc0f2082413cb9765c8e86928642553270 (diff) |
Fix DB warning being shown by zurich-overdue-alert
A raw DateTime object was being passed as a parameter in an SQL
query, which was causing undefined behaviour and a warning
every time the Zurich overdue problems script was run.
The DateTime is now converted into a format suitable for use in
the query and the warning has gone.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/zurich-overdue-alert | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bin/zurich-overdue-alert b/bin/zurich-overdue-alert index 4e81b3263..e7c23b493 100755 --- a/bin/zurich-overdue-alert +++ b/bin/zurich-overdue-alert @@ -29,10 +29,12 @@ loop_through( 'alert-overdue.txt', 0, 6, ['confirmed', 'planned'] ); sub loop_through { my ( $template, $include_parent, $days, $states ) = @_; + my $dtf = FixMyStreet::App->model("DB")->storage->datetime_parser; + my $date_threshold = $dtf->format_datetime(FixMyStreet::Cobrand::Zurich::sub_days( $now, $days )); my $reports = FixMyStreet::App->model("DB::Problem")->search( { state => $states, - created => { '<', FixMyStreet::Cobrand::Zurich::sub_days( $now, $days ) }, + created => { '<', $date_threshold }, bodies_str => { '!=', undef }, } ); |