aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Problems.pm
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2011-06-02 18:45:26 +0100
committerStruan Donald <struan@exo.org.uk>2011-06-02 18:45:26 +0100
commitc848e3bfba1ec644805c0e8b0a24c3a968d7ec3b (patch)
tree25e4b77f5b0ff3ccdce1896b30c619f3d3e0b1a6 /perllib/Problems.pm
parent040e507c4e0be26c777ca21c06f1cb45c17749f3 (diff)
parent53455ab83400aeeae9341cd720eef9fae53af221 (diff)
Merge branch 'migrate_to_catalyst' of ssh://git.mysociety.org/data/git/public/fixmystreet into migrate_to_catalyst
Diffstat (limited to 'perllib/Problems.pm')
-rw-r--r--perllib/Problems.pm17
1 files changed, 9 insertions, 8 deletions
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;
}