diff options
Diffstat (limited to 'perllib')
-rw-r--r-- | perllib/FixMyStreet/Alert.pm | 4 | ||||
-rw-r--r-- | perllib/Page.pm | 15 | ||||
-rw-r--r-- | perllib/Problems.pm | 2 | ||||
-rw-r--r-- | perllib/Utils.pm | 29 |
4 files changed, 42 insertions, 8 deletions
diff --git a/perllib/FixMyStreet/Alert.pm b/perllib/FixMyStreet/Alert.pm index cfe9c1781..11ede31ca 100644 --- a/perllib/FixMyStreet/Alert.pm +++ b/perllib/FixMyStreet/Alert.pm @@ -158,11 +158,11 @@ sub email_alerts ($) { if (!$data{alert_email}) { %data = (%data, %$row); if ($ref eq 'area_problems' || $ref eq 'council_problems' || $ref eq 'ward_problems') { - my $va_info = mySociety::MaPit::get_voting_area_info($row->{alert_parameter}); + my $va_info = mySociety::MaPit::call('area', $row->{alert_parameter}); $data{area_name} = $va_info->{name}; } if ($ref eq 'ward_problems') { - my $va_info = mySociety::MaPit::get_voting_area_info($row->{alert_parameter2}); + my $va_info = mySociety::MaPit::call('area', $row->{alert_parameter2}); $data{ward_name} = $va_info->{name}; } } diff --git a/perllib/Page.pm b/perllib/Page.pm index 391926b4f..b2e579888 100644 --- a/perllib/Page.pm +++ b/perllib/Page.pm @@ -606,12 +606,17 @@ sub display_problem_meta_line($$) { $out .= '; ' . _('the map was not used so pin location may be inaccurate') unless ($problem->{used_map}); if ($problem->{council}) { if ($problem->{whensent}) { - $problem->{council} =~ s/\|.*//g; - my @councils = split /,/, $problem->{council}; - my $areas_info = mySociety::MaPit::call('areas', \@councils); - my $council = join(' and ', map { $areas_info->{$_}->{name} } @councils); + my $body; + if ($problem->{external_body}) { + $body = $problem->{external_body}; + } else { + $problem->{council} =~ s/\|.*//g; + my @councils = split /,/, $problem->{council}; + my $areas_info = mySociety::MaPit::call('areas', \@councils); + $body = join(' and ', map { $areas_info->{$_}->{name} } @councils); + } $out .= '<small class="council_sent_info">'; - $out .= $q->br() . sprintf(_('Sent to %s %s later'), $council, prettify_duration($problem->{whensent}, 'minute')); + $out .= $q->br() . sprintf(_('Sent to %s %s later'), $body, prettify_duration($problem->{whensent}, 'minute')); $out .= '</small>'; } } else { diff --git a/perllib/Problems.pm b/perllib/Problems.pm index 111583fd5..860ae04a0 100644 --- a/perllib/Problems.pm +++ b/perllib/Problems.pm @@ -236,7 +236,7 @@ sub fetch_problem { used_map, name, anonymous, extract(epoch from confirmed) as time, state, extract(epoch from whensent-confirmed) as whensent, extract(epoch from ms_current_timestamp()-lastupdate) as duration, - service, cobrand, cobrand_data + service, cobrand, cobrand_data, external_body from problem where id=? and state in ('confirmed','fixed', 'hidden') $site_restriction", {}, $id ); diff --git a/perllib/Utils.pm b/perllib/Utils.pm index 21994d20b..c16a02cd4 100644 --- a/perllib/Utils.pm +++ b/perllib/Utils.pm @@ -107,4 +107,33 @@ sub truncate_coordinate { return $out; } +sub london_categories { + return { + 'Abandoned vehicle' => 'AbandonedVehicle', + 'Car parking' => 'Parking', + 'Dangerous structure' => 'DangerousStructure', + 'Dead animal' => 'DeadAnimal', + 'Dumped cylinder' => 'DumpedCylinder', + 'Dumped rubbish' => 'DumpedRubbish', + 'Flyposting' => 'FlyPosting', + 'Graffiti' => 'Graffiti', + 'Litter bin' => 'LitterBin', + 'Public toilet' => 'PublicToilet', + 'Refuse collection' => 'RefuseCollection', + 'Road or pavement defect' => 'Road', + 'Road or pavement obstruction' => 'Obstruction', + 'Skip problem' => 'Skip', + 'Street cleaning' => 'StreetCleaning', + 'Street drainage' => 'StreetDrainage', + 'Street furniture' => 'StreetFurniture', + 'Street needs gritting' => 'StreetGritting', + 'Street lighting' => 'StreetLighting', + 'Street sign' => 'StreetSign', + 'Traffic light' => 'TrafficLight', + 'Tree (dangerous)' => 'DangerousTree', + 'Tree (fallen branches)' => 'FallenTree', + 'Untaxed vehicle' => 'UntaxedVehicle', + }; +} + 1; |