diff options
-rwxr-xr-x | bin/send-reports | 6 | ||||
-rw-r--r-- | db/schema.sql | 3 | ||||
-rw-r--r-- | templates/emails/submit-council | 3 | ||||
-rwxr-xr-x | web/index.cgi | 11 |
4 files changed, 14 insertions, 9 deletions
diff --git a/bin/send-reports b/bin/send-reports index 45927b06b..f554ee454 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -6,7 +6,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: send-reports,v 1.4 2007-02-02 16:17:17 matthew Exp $ +# $Id: send-reports,v 1.5 2007-02-02 16:31:52 matthew Exp $ use strict; require 5.8.0; @@ -35,7 +35,7 @@ BEGIN { } my $unsent = dbh()->selectall_arrayref( - "SELECT id, council, title, detail, created, name, email, phone + "SELECT id, council, title, detail, created, name, email, phone, used_map FROM problem WHERE state = 'confirmed' AND whensent IS NULL", { Slice => {} }); foreach my $row (@$unsent) { # XXX Needs locks! @@ -56,6 +56,8 @@ foreach my $row (@$unsent) { $h{user_details} .= ' (' . $row->{phone} . ')' if $row->{phone}; $h{url} = mySociety::Config::get('BASE_URL') . '/?id=' . $row->{id}; $h{councils_name} = join(' and ', map { $areas_info->{$_}->{name} } @councils); + $h{fuzzy} = $row->{used_map} ? 'To view a map of the precise location of this issue' + : 'The user could not locate the problem on a map, but to see the area around the location they entered'; my $email = mySociety::Email::construct_email({ _template_ => $template, _parameters_ => \%h, diff --git a/db/schema.sql b/db/schema.sql index a882a5ef5..b7ef22abd 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -4,7 +4,7 @@ -- Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. -- Email: matthew@mysociety.org; WWW: http://www.mysociety.org/ -- --- $Id: schema.sql,v 1.17 2007-02-02 11:57:50 matthew Exp $ +-- $Id: schema.sql,v 1.18 2007-02-02 16:31:52 matthew Exp $ -- -- secret @@ -129,6 +129,7 @@ create table problem ( title text not null, detail text not null, photo bytea, + used_map boolean not null, -- category integer not null references category(id), -- User's details diff --git a/templates/emails/submit-council b/templates/emails/submit-council index c33349deb..ba535cfbe 100644 --- a/templates/emails/submit-council +++ b/templates/emails/submit-council @@ -13,8 +13,7 @@ has submitted the following report: ---------- -To view a map of the precise location of this issue, or to provide an update -on the problem, please visit the following link: +<?=$values['fuzzy']?>, or to provide an update on the problem, please visit the following link: <?=$values['url']?> diff --git a/web/index.cgi b/web/index.cgi index daaa1f312..a0544bc52 100755 --- a/web/index.cgi +++ b/web/index.cgi @@ -6,7 +6,7 @@ # Copyright (c) 2006 UK Citizens Online Democracy. All rights reserved. # Email: matthew@mysociety.org. WWW: http://www.mysociety.org # -# $Id: index.cgi,v 1.64 2007-02-02 16:17:18 matthew Exp $ +# $Id: index.cgi,v 1.65 2007-02-02 16:31:53 matthew Exp $ # TODO # Nothing is done about the update checkboxes - not stored anywhere on anything! @@ -148,7 +148,7 @@ sub submit_update { sub submit_problem { my $q = shift; - my @vars = qw(council title detail name email phone pc easting northing); + my @vars = qw(council title detail name email phone pc easting northing skipped); my %input = map { $_ => scalar $q->param($_) } @vars; my @errors; @@ -208,12 +208,14 @@ sub submit_problem { } delete $input{council} if $input{council} == -1; + my $used_map = $input{skipped} ? 'f' : 't'; # This is horrid my $s = dbh()->prepare("insert into problem - (id, postcode, easting, northing, title, detail, name, email, phone, photo, state, council) + (id, postcode, easting, northing, title, detail, name, + email, phone, photo, state, council, used_map) values - (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?)"); + (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'unconfirmed', ?, ?)"); $s->bind_param(1, $id); $s->bind_param(2, $input{pc}); $s->bind_param(3, $input{easting}); @@ -225,6 +227,7 @@ sub submit_problem { $s->bind_param(9, $input{phone}); $s->bind_param(10, $image, { pg_type => DBD::Pg::PG_BYTEA }); $s->bind_param(11, $input{council}); + $s->bind_param(12, $used_map); $s->execute(); my %h = (); $h{title} = $input{title}; |