aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2011-09-20 15:44:22 +0100
committerMatthew Somerville <matthew@mysociety.org>2011-09-20 15:44:22 +0100
commit891ce12c012e2c02e8f024f3701ca9ceef5a4bbf (patch)
tree769c51c48e6427cb5ded45343b2b6abbe3db5e34 /perllib/FixMyStreet/DB
parent3a05b6e399de926decfe732a8bff9f4e80fc39c5 (diff)
Decode template files read in with read_file, to prevent double encoding (fixes #159). Also fix Welsh I18N test.
Diffstat (limited to 'perllib/FixMyStreet/DB')
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm4
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm6
2 files changed, 4 insertions, 6 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index bf085e32a..c1a5d65c9 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -4,8 +4,6 @@ use base 'DBIx::Class::ResultSet';
use strict;
use warnings;
-use File::Slurp;
-
use mySociety::DBHandle qw(dbh);
use mySociety::EmailUtil;
use mySociety::Gaze;
@@ -189,7 +187,7 @@ sub _send_aggregated_alert_email(%) {
unless -e $template;
$template = FixMyStreet->path_to( "templates", "email", "default", "$data{template}.txt" )->stringify
unless -e $template;
- $template = File::Slurp::read_file($template);
+ $template = Utils::read_file($template);
my $sender = $cobrand->contact_email;
(my $from = $sender) =~ s/team/fms-DO-NOT-REPLY/; # XXX
diff --git a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
index 665e0e3e0..0cf01b6d1 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Questionnaire.pm
@@ -3,7 +3,7 @@ use base 'DBIx::Class::ResultSet';
use strict;
use warnings;
-use File::Slurp;
+use Encode;
use Utils;
use mySociety::EmailUtil;
@@ -57,12 +57,12 @@ sub send_questionnaires_period {
my $template;
if ($params->{site} eq 'emptyhomes') {
($template = $period) =~ s/ //;
- $template = File::Slurp::read_file( FixMyStreet->path_to( "templates/email/emptyhomes/" . $row->lang . "/questionnaire-$template.txt" )->stringify );
+ $template = Utils::read_file( FixMyStreet->path_to( "templates/email/emptyhomes/" . $row->lang . "/questionnaire-$template.txt" )->stringify );
} else {
$template = FixMyStreet->path_to( "templates", "email", $cobrand->moniker, "questionnaire.txt" )->stringify;
$template = FixMyStreet->path_to( "templates", "email", "default", "questionnaire.txt" )->stringify
unless -e $template;
- $template = File::Slurp::read_file( $template );
+ $template = Utils::read_file( $template );
}
my %h = map { $_ => $row->$_ } qw/name title detail category/;