aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm12
-rw-r--r--perllib/FixMyStreet/Cobrand/LichfieldDC.pm11
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm7
3 files changed, 26 insertions, 4 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 5eee5f731..2943c9ac4 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -98,6 +98,18 @@ Return the base url for the cobranded version of the site
sub base_url { mySociety::Config::get('BASE_URL') }
+=head2 url_for_report
+
+Return the url for a report (might be different in a two-tier county, but
+most of the time will be same as base_url).
+
+=cut
+
+sub url_for_report {
+ my ( $self, $problem ) = @_;
+ return $self->base_url . $problem->url;
+}
+
=head2 base_host
Return the base host for the cobranded version of the site
diff --git a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
index d0b000102..f98775c91 100644
--- a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
+++ b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
@@ -26,5 +26,16 @@ sub disambiguate_location {
};
}
+# If we ever link to a county problem report, needs to be to main FixMyStreet
+sub url_for_report {
+ my ( $self, $problem ) = @_;
+ my %councils = map { $_ => 1 } @{$problem->councils};
+ if ( $councils{2434} ) {
+ return $self->base_url . $problem->url;
+ } else {
+ return FixMyStreet->config('BASE_URL') . $problem->url;
+ }
+}
+
1;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 9cbaef6c2..4af6f80cd 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -551,9 +551,8 @@ sub body {
if ($problem->external_body) {
$body = $problem->external_body;
} else {
- (my $council = $problem->council) =~ s/\|.*//g;
- my @councils = split( /,/, $council );
- my $areas_info = mySociety::MaPit::call('areas', \@councils);
+ my $councils = $problem->councils;
+ my $areas_info = mySociety::MaPit::call('areas', $councils);
$body = join( _(' and '),
map {
my $name = $areas_info->{$_}->{name};
@@ -564,7 +563,7 @@ sub body {
} else {
$name;
}
- } @councils
+ } @$councils
);
}
return $body;