aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2014-04-11 10:34:37 +0100
committerStruan Donald <struan@exo.org.uk>2014-04-11 10:34:37 +0100
commite6d0b61e1a406cc79a5a8390fc148b51d2e36e76 (patch)
tree5a1d2f8deb2d822a2e669249a46df0bfd2c77ed7 /perllib/FixMyStreet/DB
parent03244f1e7d9a03ab704f797a19893c1efdb2b1e6 (diff)
parentdbe9c7ecb157196ed201d94d4159abfb034240ff (diff)
Merge branch 'zerotb'
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm22
1 files changed, 22 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 8e18832a9..545b54c60 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -29,6 +29,7 @@ sub email_alerts ($) {
$query .= "
$item_table.id as item_id, $item_table.text as item_text,
$item_table.name as item_name, $item_table.anonymous as item_anonymous,
+ $item_table.confirmed as item_confirmed,
$head_table.*
from alert
inner join $item_table on alert.parameter::integer = $item_table.${head_table}_id
@@ -114,6 +115,27 @@ sub email_alerts ($) {
$data{problem_url} = $url . "/report/" . $row->{id};
}
$data{data} .= $row->{item_name} . ' : ' if $row->{item_name} && !$row->{item_anonymous};
+ if ( $cobrand->include_time_in_update_alerts ) {
+ # this is basically recreating the code from the inflate wrapper
+ # in the database model.
+ my $tz;
+ if ( FixMyStreet->config('TIME_ZONE') ) {
+ $tz = FixMyStreet->config('TIME_ZONE');
+ }
+
+ my $parser = DateTime::Format::Pg->new();
+ my $dt = $parser->parse_timestamp( $row->{item_confirmed} );
+ my $l_tz = DateTime::TimeZone->new( name => "local" );
+ # We need to always set this otherwise we end up with the DateTime
+ # object being in the floating timezone in which case applying a
+ # subsequent timezone set will have no effect.
+ $dt->set_time_zone( $l_tz );
+ if ( $tz ) {
+ my $tz_obj = DateTime::TimeZone->new( name => $tz );
+ $dt->set_time_zone( $tz_obj );
+ }
+ $data{data} .= $cobrand->prettify_dt( $dt, 'alert' ) . "\n\n";
+ }
$data{data} .= $row->{item_text} . "\n\n------\n\n";
# this is ward and council problems
} else {