diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/send-questionnaires | 2 | ||||
-rwxr-xr-x | bin/send-questionnaires-eha | 1 | ||||
-rwxr-xr-x | bin/send-reports | 15 | ||||
-rwxr-xr-x | bin/test-run | 18 |
4 files changed, 20 insertions, 16 deletions
diff --git a/bin/send-questionnaires b/bin/send-questionnaires index 840f70b2c..eb67cd5d1 100755 --- a/bin/send-questionnaires +++ b/bin/send-questionnaires @@ -70,7 +70,7 @@ foreach my $row (@$unsent) { next unless (Cobrand::email_host($cobrand)); my ($councils, $missing) = $row->{council} =~ /^([\d,]+)(?:\|([\d,]+))?/; my @councils = split /,/, $councils; - my $areas_info = mySociety::MaPit::get_voting_areas_info(\@all_councils); + my $areas_info = mySociety::MaPit::call('areas', \@all_councils); my $template = File::Slurp::read_file("$FindBin::Bin/../templates/emails/questionnaire"); my %h = map { $_ => $row->{$_} } qw/name title detail category/; diff --git a/bin/send-questionnaires-eha b/bin/send-questionnaires-eha index 18375b8c6..2e0af8f4f 100755 --- a/bin/send-questionnaires-eha +++ b/bin/send-questionnaires-eha @@ -25,7 +25,6 @@ use mySociety::Config; use mySociety::DBHandle qw(dbh select_all); use mySociety::Email; use mySociety::Locale; -use mySociety::MaPit; use mySociety::EmailUtil; use mySociety::Random qw(random_bytes); diff --git a/bin/send-reports b/bin/send-reports index 9abc9c6c0..c91de5e33 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -15,6 +15,7 @@ require 5.8.0; use FindBin; use lib "$FindBin::Bin/../perllib"; use lib "$FindBin::Bin/../commonlib/perllib"; +use Encode; use Error qw(:try); use File::Slurp; use CGI; # Trying awkward kludge @@ -107,7 +108,7 @@ foreach my $row (@$unsent) { if ($site eq 'emptyhomes') { my $council = $row->{council}; - $areas_info = mySociety::MaPit::get_voting_areas_info([ $council ]); + $areas_info = mySociety::MaPit::call('areas', $council); my $name = $areas_info->{$council}->{name}; my ($council_email, $confirmed, $note) = dbh()->selectrow_array( "SELECT email,confirmed,note FROM contacts WHERE deleted='f' @@ -131,7 +132,7 @@ foreach my $row (@$unsent) { my @all_councils = split /,|\|/, $row->{council}; my ($councils, $missing) = $row->{council} =~ /^([\d,]+)(?:\|([\d,]+))?/; my @councils = split /,/, $councils; - $areas_info = mySociety::MaPit::get_voting_areas_info(\@all_councils); + $areas_info = mySociety::MaPit::call('areas', \@all_councils); my (@dear, %recips); my $all_confirmed = 1; foreach my $council (@councils) { @@ -266,7 +267,7 @@ if ($verbose) { # Will do for now :) sub essex_contact { my ($E, $N) = @_; - my $district = mySociety::MaPit::get_voting_areas_by_location({easting=>$E, northing=>$N}, 'polygon', 'DIS'); + my $district = mySociety::MaPit::call('point', "27700/$E,$N", type => 'DIS'); ($district) = keys %$district; my $email; $email = 'eastarea' if $district == 2315 || $district == 2312; @@ -280,7 +281,7 @@ sub essex_contact { # Oxfordshire has different contact addresses depending upon the district sub oxfordshire_contact { my ($E, $N) = @_; - my $district = mySociety::MaPit::get_voting_areas_by_location({easting=>$E, northing=>$N}, 'polygon', 'DIS'); + my $district = mySociety::MaPit::call('point', "27700/$E,$N", type => 'DIS'); ($district) = keys %$district; my $email; $email = 'northernarea' if $district == 2419 || $district == 2420 || $district == 2421; @@ -315,9 +316,11 @@ sub post_easthants_message { $eh_service ||= EastHantsWSDL->on_fault(sub { my($soap, $res) = @_; die ref $res ? $res->faultstring : $soap->transport->status, "\n"; }); try { # ServiceName, RemoteCreatedBy, Salutation, FirstName, Name, Email, Telephone, HouseNoName, Street, Town, County, Country, Postcode, Comments, FurtherInfo, ImageURL + my $message = ent(encode_utf8($h{message})); + my $name = ent(encode_utf8($h{name})); my $result = $eh_service->INPUTFEEDBACK( - $h{category}, 'FixMyStreet', '', '', ent($h{name}), $h{email}, $h{phone}, - '', '', '', '', '', '', ent($h{message}), 'Yes', $h{image_url} + $h{category}, 'FixMyStreet', '', '', $name, $h{email}, $h{phone}, + '', '', '', '', '', '', $message, 'Yes', $h{image_url} ); $return = 0 if $result eq 'Report received'; } otherwise { diff --git a/bin/test-run b/bin/test-run index b0969053a..3e5f76afa 100755 --- a/bin/test-run +++ b/bin/test-run @@ -377,13 +377,13 @@ sub do_alert { # sign up for alerts in an area my $postcode = 'EH1 2NG'; - my $x = 2015; - my $y = 4175; + my $x = 2015; my $e = 325000; + my $y = 4175; my $n = 673548; my $messages = english_fms_messages(); submit_postcode('', $postcode, 'Problems in this area'); $wth->browser_follow_link(text => 'Email me new local problems'); $wth->browser_submit_form(form_name => 'alerts', - fields => {feed => "local:" . $x . ":" . $y, + fields => {feed => "local:" . $e . ":" . $n, rznvy => email_n(2)} ); $wth->browser_check_contents('Nearly Done!'); my $confirmation_email = $wth->email_get_containing( @@ -417,8 +417,8 @@ sub do_alert { sub do_eha_alert { # sign up for alerts in an area my $postcode = 'EH1 2NG'; - my $x = 2015; - my $y = 4175; + my $x = 2015; my $e = 325000; + my $y = 4175; my $n = 673548; my @texts = ('Eiddo gwag yn yr ardal hon', 'Adrodd am eiddo gwag', 'Nawr, gwiriwch eich e-bost', @@ -428,7 +428,7 @@ sub do_eha_alert { submit_postcode('cy.emptyhomes.', $postcode, $texts[0]); $wth->browser_follow_link(text => 'Anfonwch fanylion eiddo gwag lleol newydd ataf i drwy\'r e-bost'); $wth->browser_submit_form(form_name => 'alerts', - fields => {feed => "local:" . $x . ":" . $y, + fields => {feed => "local:" . $e . ":" . $n, rznvy => email_n(4)} ); $wth->browser_check_contents($texts[2]); my $confirmation_email = $wth->email_get_containing( @@ -514,11 +514,13 @@ sub do_static { # Just checks header, doesn't check any contents. sub do_rss { $wth->browser_get($base_url . '/rss/l/52.5/-1.9'); - die "Lat/lon redirect failed" unless $wth->browser_uri() =~ m{/rss/2522/1792$}; + die "Lat/lon redirect failed" unless $wth->browser_uri() =~ m{/rss/n/406886,289126$}; $wth->browser_get($base_url . '/rss/2524/1779'); + die "Tile redirect failed" unless $wth->browser_uri() =~ m{/rss/n/407097,286935$}; + $wth->browser_get($base_url . '/rss/n/407097,286935'); $wth->browser_check_contents('New local problems on FixMyStreet'); $wth->browser_get($base_url . '/rss/pc/SW1A1AA'); - die "Postcode redirect failed" unless $wth->browser_uri() =~ m{/rss/3279/1113$}; + die "Postcode redirect failed" unless $wth->browser_uri() =~ m{/rss/n/529090,179645$}; $wth->browser_get($base_url . '/rss/area/Birmingham'); die "One-tier redirect failed" unless $wth->browser_uri() =~ m{/rss/reports/Birmingham$}; $wth->browser_get($base_url . '/rss/reports/Birmingham'); |