aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-reports5
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm19
-rw-r--r--perllib/Utils.pm27
3 files changed, 48 insertions, 3 deletions
diff --git a/bin/send-reports b/bin/send-reports
index 07bef2a9e..971195cf0 100755
--- a/bin/send-reports
+++ b/bin/send-reports
@@ -426,7 +426,10 @@ EOF
sub post_barnet_message {
my ( $problem, %h ) = @_;
my $return = 1;
- my $kbid = '00000000000000000000000000000000000000000000000014'; # There is only one category
+
+ my $default_kbid = 14; # This is the default, "Street Scene"
+ my $kbid = sprintf( "%060d", Utils::barnet_categories()->{$h{category}} || $default_kbid);
+
my $geo_code = "$h{easting} $h{northing}";
my $interface = BarnetInterfaces::service::ZLBB_SERVICE_ORDER->new();
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index af4cdd5aa..f9cede143 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -78,6 +78,8 @@ partial
=cut
+use constant COUNCIL_ID_BARNET => 2489;
+
sub report_new : Path : Args(0) {
my ( $self, $c ) = @_;
@@ -545,9 +547,15 @@ sub setup_categories_and_councils : Private {
} elsif ($first_council->{type} eq 'LBO') {
$area_ids_to_list{ $first_council->{id} } = 1;
+ my @local_categories;
+ if ($first_council->{id} == COUNCIL_ID_BARNET) {
+ @local_categories = (sort(keys %{ Utils::barnet_categories() }), _('Other') )
+ } else {
+ @local_categories = sort keys %{ Utils::london_categories() }
+ }
@category_options = (
_('-- Pick a category --'),
- sort keys %{ Utils::london_categories() }
+ @local_categories
);
$category_label = _('Category:');
@@ -733,8 +741,15 @@ sub process_report : Private {
$councils = join( ',', @{ $c->stash->{area_ids_to_list} } ) || -1;
$report->council( $councils );
- } elsif ( $first_council->{type} eq 'LBO') {
+ } elsif ( $first_council->{id} == COUNCIL_ID_BARNET ) {
+ unless ( Utils::barnet_categories()->{ $report->category } or $report->category eq 'Other') {
+ $c->stash->{field_errors}->{category} = _('Please choose a category');
+ }
+ $report->council( $first_council->{id} );
+
+ } elsif ( $first_council->{type} eq 'LBO') {
+
unless ( Utils::london_categories()->{ $report->category } ) {
$c->stash->{field_errors}->{category} = _('Please choose a category');
}
diff --git a/perllib/Utils.pm b/perllib/Utils.pm
index 4e64836c6..3c8978881 100644
--- a/perllib/Utils.pm
+++ b/perllib/Utils.pm
@@ -140,6 +140,33 @@ sub london_categories {
};
}
+sub barnet_categories {
+ # The values here are KBIDs from Barnet's system: see bin/send-reports for formatting
+ # category KBID Barnet's title for this KBID
+ return {
+ 'Abandoned vehicle' => 0,
+ 'Blocked gully/drain' => 255, # Gullies-Blocked
+ 'Bus stop' => 0,
+ 'Dead animal' => 286, # Animals-Dead-Removal
+ 'Dog fouling' => 288, # Dog Fouling-Clear
+ 'Flyposting' => 0,
+ 'Flytipping' => 347, # Fly tipping-Clear
+ 'Graffiti' => 292, # Graffiti-Removal
+ 'Park/landscape' => 0,
+ 'Pavement/footpath' => 195, # Pavements-Damaged/Cracked
+ 'Pothole' => 204, # Pothole
+ 'Public toilet' => 0,
+ 'Road sign' => 432, # Roads Signs - Maintenance
+ 'Roads/highways' => 190, # Complaint-Highways Maintenance
+ 'Rubbish/litter' => 349, # Accumulated Litter
+ 'Street cleaning' => 0,
+ 'Street lighting' => 251, # Street Lighting
+ 'Street nameplate' => 0,
+ 'Traffic lights' => 103, # Traffic lights
+ 'Tree' => 162, # Tree section
+ };
+}
+
=head2 trim_text
my $text = trim_text( $text_to_trim );