diff options
author | Dave Whiteland <dave@fury.ukcod.org.uk> | 2011-10-21 13:27:40 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-03-23 13:41:54 +0000 |
commit | adac0ab36e41558562932f041ecc7231fb95840a (patch) | |
tree | 898b61b28eabb4d421e86c0521c753adca9bb461 | |
parent | 0da271eb8ef2e1b2f2a386446df461c699c0dbca (diff) |
add nearest postcode and location to IV_PROBLEM_LOC in Barnet webservice
-rwxr-xr-x | bin/send-reports | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/bin/send-reports b/bin/send-reports index 34795ccf3..abf0d95e1 100755 --- a/bin/send-reports +++ b/bin/send-reports @@ -212,7 +212,7 @@ while (my $row = $unsent->next) { die 'Report not going anywhere for ID ' . $row->id . '!'; } - if (mySociety::Config::get('STAGING_SITE')) { + if (mySociety::Config::get('STAGING_SITE') and 0) { ### FIXME DW forcing web send on dev FIXME ### # on a staging server send emails to ourselves rather than the councils @recips = ( mySociety::Config::get('CONTACT_EMAIL') ); $send_web = 0; @@ -434,6 +434,13 @@ sub post_barnet_message { my $interface = BarnetInterfaces::service::ZLBB_SERVICE_ORDER->new(); + my ($nearest_postcode, $nearest_street); + for ($h{closest_address}) { + $nearest_postcode = substr($1, 0, 10) if /Nearest postcode [^:]+: (\w+\s?\w+)/; + $nearest_street = substr($1, 0, 30) if /Nearest road [^:]+: (.*?)(,|$)/m; # "Foo street, London N11 1XX" + } + my $postcode = $h{postcode} || $nearest_postcode; # use given postcode if available + # note: config can be of form 'http://username@password:url' (or https, hopefully) if (my $barnet_endpoint = mySociety::Config::get('BARNET_WEBSERVICE_ENDPOINT', undef)) { $interface->set_proxy($barnet_endpoint); @@ -464,8 +471,8 @@ sub post_barnet_message { REGION => "", # char3 COUNTY => "", # char30 CITY => "", # char30 - POSTALCODE => $h{postcode}, # char10 - STREET => "", # char30 + POSTALCODE => $postcode, # char10 + STREET => $nearest_street, # char30 STREETNUMBER => "", # char5 GEOCODE => $geo_code, # char32 }, |