diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-29 12:41:01 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-04-29 12:41:03 +0100 |
commit | 1ce37b4085a6844a7591e6048ca332f0b3a83538 (patch) | |
tree | 5d840354c6f0ad81ff98c8626e34421e71a4d195 | |
parent | ddcac0fd2596cc68ea98fe9dd8391f0ae109bfa8 (diff) |
[UK] Deal with setup where county may be missing.
Currently, Dorset Council and BCP Council are bodies linked with
the relevant areas of the now-gone district councils; this means
there is no body linked with the area of the old county council,
which causes an error.
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index 0eb350311..1c6ebe29a 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -290,7 +290,9 @@ sub council_rss_alert_options { rss_text => sprintf( _('RSS feed of %s, within %s ward'), $district->{name}, $d_ward->{name}), text => sprintf( _('Reports sent to %s, within %s ward'), $district->{name}, $d_ward->{name}), uri => $c->uri_for( '/rss/reports/' . $district->{short_name} . '/' . $d_ward->{short_name} ), - }, { + } + if $body_dis; + push @reported_to_options, { type => 'council', id => sprintf( 'council:%s:%s', $body_cty->id, $county->{id_name} ), text => sprintf( _('Reports sent to %s'), $county->{name} ), @@ -302,7 +304,8 @@ sub council_rss_alert_options { rss_text => sprintf( _('RSS feed of %s, within %s ward'), $county->{name}, $c_ward->{name}), text => sprintf( _('Reports sent to %s, within %s ward'), $county->{name}, $c_ward->{name}), uri => $c->uri_for( '/rss/reports/' . $county->{short_name} . '/' . $c_ward->{short_name} ), - }; + } + if $body_cty; } else { throw Error::Simple('An area with three tiers of council? Impossible! '. join('|',keys %$all_areas)); |