diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/App.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 16 | ||||
-rw-r--r-- | perllib/Problems.pm | 17 |
3 files changed, 18 insertions, 28 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 1d584accb..752263d10 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -278,8 +278,10 @@ sub send_email { from => FixMyStreet->config('CONTACT_EMAIL'), %{ $c->stash }, %$extra_stash_values, - additional_template_paths => - [ $c->cobrand->path_to_email_templates->stringify ] + additional_template_paths => [ + FixMyStreet->path_to( 'templates', 'email', $c->cobrand->moniker, $c->stash->{lang_code} )->stringify, + FixMyStreet->path_to( 'templates', 'email', $c->cobrand->moniker )->stringify, + ] }; # render the template @@ -292,12 +294,13 @@ sub send_email { # pass the email into mySociety::Email to construct the on the wire 7bit # format - this should probably happen in the transport instead but hohum. - my $email_text = mySociety::Email::construct_email( + my $email_text = mySociety::Locale::in_gb_locale { mySociety::Email::construct_email( { - _unwrapped_body_ => $email->body, # will get line wrapped + _template_ => $email->body, # will get line wrapped + _parameters_ => {}, $email->header_pairs } - ); + ) }; # send the email $c->model('EmailSend')->send($email_text); diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index 4c7d7438a..1f1086c21 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -90,20 +90,6 @@ sub path_to_web_templates { return FixMyStreet->path_to( 'templates/web', $self->moniker ); } -=head2 path_to_email_templates - - $path = $cobrand->path_to_email_templates( ); - -Returns the path to the templates for this cobrand - by default -"templates/email/$moniker" - -=cut - -sub path_to_email_templates { - my $self = shift; - return FixMyStreet->path_to( 'templates/email', $self->moniker ); -} - =head1 site_restriction Return a site restriction clause and a site key if the cobrand uses a subset of @@ -625,7 +611,7 @@ sub email_host { my $cobrand_moniker_uc = uc( $self->moniker ); my $email_vhost = - mySociety::Config::get("EMAIL_VHOST_$cobrand_moniker_uc") + mySociety::Config::get("EMAIL_VHOST_$cobrand_moniker_uc", '') || mySociety::Config::get("EMAIL_VHOST") || ''; diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 432c89fdc..b742932c1 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -358,10 +358,10 @@ sub problem_search { my ($search) = @_; my $search_n = 0; $search_n = int($search) if $search =~ /^\d+$/; - my $problems = select_all("select id, council, category, title, name, + my $problems = select_all("select problem.id, council, category, title, problem.name, email, anonymous, cobrand, cobrand_data, created, confirmed, state, service, lastupdate, - whensent, send_questionnaire from problem where (id=? or email ilike - '%'||?||'%' or name ilike '%'||?||'%' or title ilike '%'||?||'%' or + whensent, send_questionnaire from problem, users where problem.user_id = users.id + and (problem.id=? or email ilike '%'||?||'%' or problem.name ilike '%'||?||'%' or title ilike '%'||?||'%' or detail ilike '%'||?||'%' or council like '%'||?||'%' or cobrand_data like '%'||?||'%') $site_restriction order by (state='hidden'),created", $search_n, @@ -380,9 +380,9 @@ sub update_search { my $search_n = 0; $search_n = int($search) if $search =~ /^\d+$/; my $updates = select_all("select comment.*, problem.council, problem.state as problem_state - from comment, problem where problem.id = comment.problem_id + from comment, problem, users where problem.id = comment.problem_id and comment.user_id = users.id and (comment.id=? or - problem_id=? or comment.email ilike '%'||?||'%' or comment.name ilike '%'||?||'%' or + problem_id=? or users.email ilike '%'||?||'%' or comment.name ilike '%'||?||'%' or comment.text ilike '%'||?||'%' or comment.cobrand_data ilike '%'||?||'%') $site_restriction order by (comment.state='hidden'),(problem.state='hidden'),created", $search_n, $search_n, $search, $search, @@ -475,8 +475,8 @@ Uses any site_restriction defined by a cobrand. sub admin_fetch_problem { my ($id) = @_; - my $problem = dbh()->selectall_arrayref("select * from problem - where id=? + my $problem = dbh()->selectall_arrayref("select problem.*, users.email from problem, users + where problem.id=? and users.id = problem.user_id $site_restriction", { Slice=>{} }, $id); return $problem; } @@ -489,9 +489,10 @@ Uses any site_restriction defined by a cobrand. =cut sub admin_fetch_update { my ($id) = @_; - my $update = dbh()->selectall_arrayref("select comment.*, problem.council from comment, problem + my $update = dbh()->selectall_arrayref("select comment.*, problem.council, users.email from comment, problem, users where comment.id=? and problem.id = comment.problem_id + and users.id = comment.user_id $site_restriction", { Slice=>{} }, $id); return $update; } |