aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/send-comments20
-rwxr-xr-xbin/update-all-reports28
-rw-r--r--db/alert_types.sql8
-rw-r--r--db/alert_types_eha.sql8
-rw-r--r--db/schema.sql4
-rw-r--r--db/schema_0031-rename-problem-council-column.sql5
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/Dashboard.pm2
-rw-r--r--perllib/FixMyStreet/App/Controller/JSON.pm20
-rw-r--r--perllib/FixMyStreet/App/Controller/Open311.pm22
-rw-r--r--perllib/FixMyStreet/App/Controller/Report.pm9
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/New.pm18
-rw-r--r--perllib/FixMyStreet/App/Controller/Report/Update.pm6
-rw-r--r--perllib/FixMyStreet/App/Controller/Reports.pm25
-rwxr-xr-xperllib/FixMyStreet/App/Controller/Rss.pm2
-rw-r--r--perllib/FixMyStreet/Cobrand/Default.pm4
-rw-r--r--perllib/FixMyStreet/Cobrand/LichfieldDC.pm6
-rw-r--r--perllib/FixMyStreet/Cobrand/UK.pm12
-rw-r--r--perllib/FixMyStreet/Cobrand/UKCouncils.pm6
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm36
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/AlertType.pm6
-rw-r--r--perllib/FixMyStreet/DB/ResultSet/Problem.pm10
-rw-r--r--perllib/FixMyStreet/SendReport/Email.pm4
-rw-r--r--perllib/FixMyStreet/SendReport/Open311.pm8
-rw-r--r--perllib/FixMyStreet/TestMech.pm16
-rw-r--r--perllib/Open311/GetServiceRequestUpdates.pm20
-rw-r--r--t/app/controller/admin.t10
-rw-r--r--t/app/controller/alert_new.t6
-rw-r--r--t/app/controller/around.t2
-rw-r--r--t/app/controller/index.t4
-rw-r--r--t/app/controller/json.t2
-rw-r--r--t/app/controller/questionnaire.t2
-rw-r--r--t/app/controller/report_display.t4
-rw-r--r--t/app/controller/report_interest_count.t4
-rw-r--r--t/app/controller/report_new.t8
-rw-r--r--t/app/controller/report_updates.t4
-rw-r--r--t/app/controller/reports.t8
-rw-r--r--templates/web/bromley/report/display.html2
-rw-r--r--templates/web/bromley/report/new/fill_in_details_form.html4
-rw-r--r--templates/web/default/admin/list_updates.html2
-rw-r--r--templates/web/default/admin/problem_row.html4
-rw-r--r--templates/web/default/admin/report_edit.html2
-rw-r--r--templates/web/default/admin/timeline.html2
-rw-r--r--templates/web/default/admin/update_edit.html2
-rw-r--r--templates/web/default/questionnaire/completed.html2
-rw-r--r--templates/web/default/report/_main.html2
-rw-r--r--templates/web/default/report/new/fill_in_details_form.html4
-rw-r--r--templates/web/default/report/update-form.html2
-rwxr-xr-xtemplates/web/default/reports/_list-entry.html4
-rw-r--r--templates/web/default/tokens/confirm_problem.html2
-rw-r--r--templates/web/emptyhomes/report/display.html2
-rw-r--r--templates/web/emptyhomes/tokens/confirm_problem.html2
-rw-r--r--templates/web/fixmystreet/report/_item.html4
-rw-r--r--templates/web/fixmystreet/report/new/fill_in_details_form.html4
-rw-r--r--templates/web/fixmystreet/report/update-form.html4
-rw-r--r--templates/web/fixmystreet/report/updates-sidebar-notes.html2
-rw-r--r--templates/web/zurich/report/new/fill_in_details_form.html4
57 files changed, 202 insertions, 215 deletions
diff --git a/bin/send-comments b/bin/send-comments
index caf4b8b91..7520af17d 100755
--- a/bin/send-comments
+++ b/bin/send-comments
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
# send-reports:
-# Send new problem reports to councils
+# Send new problem reports to bodies
#
# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved.
# Email: matthew@mysociety.org. WWW: http://www.mysociety.org
@@ -35,12 +35,12 @@ my ($verbose, $nomail) = CronFns::options();
my $base_url = mySociety::Config::get('BASE_URL');
my $site = CronFns::site($base_url);
-my $councils = FixMyStreet::App->model('DB::Body')->search( {
+my $bodies = FixMyStreet::App->model('DB::Body')->search( {
send_method => SEND_METHOD_OPEN311,
send_comments => 1,
} );
-while ( my $council = $councils->next ) {
+while ( my $body = $bodies->next ) {
my $use_extended = 0;
my $comments = FixMyStreet::App->model('DB::Comment')->search( {
'me.whensent' => undef,
@@ -49,7 +49,7 @@ while ( my $council = $councils->next ) {
'me.confirmed' => { '!=' => undef },
'problem.whensent' => { '!=' => undef },
'problem.external_id' => { '!=' => undef },
- 'problem.council' => { -like => '%' . $council->area_id .'%' },
+ 'problem.bodies_str' => { -like => '%' . $body->area_id .'%' },
'problem.send_method_used' => 'Open311',
},
{
@@ -57,18 +57,18 @@ while ( my $council = $councils->next ) {
}
);
- if ( $council->area_id == 2482 ) {
+ if ( $body->area_id == 2482 ) {
$use_extended = 1;
}
my $o = Open311->new(
- endpoint => $council->endpoint,
- jurisdiction => $council->jurisdiction,
- api_key => $council->api_key,
+ endpoint => $body->endpoint,
+ jurisdiction => $body->jurisdiction,
+ api_key => $body->api_key,
use_extended_updates => $use_extended,
);
- if ( $council->area_id =~ /2482/ ) {
+ if ( $body->area_id == 2482 ) {
my $endpoints = $o->endpoints;
$endpoints->{update} = 'update.xml';
$endpoints->{service_request_updates} = 'update.xml';
@@ -82,7 +82,7 @@ while ( my $council = $councils->next ) {
next if bromley_retry_timeout( $comment );
}
- if ( $council->area_id == 2482 ) {
+ if ( $body->area_id == 2482 ) {
my $extra = $comment->extra;
if ( !$extra ) {
$extra = {};
diff --git a/bin/update-all-reports b/bin/update-all-reports
index 4c4838c77..e9edae0af 100755
--- a/bin/update-all-reports
+++ b/bin/update-all-reports
@@ -24,7 +24,7 @@ my $problems = FixMyStreet::App->model("DB::Problem")->search(
},
{
columns => [
- 'id', 'council', 'state', 'areas',
+ 'id', 'bodies_str', 'state', 'areas',
{ duration => { extract => "epoch from current_timestamp-lastupdate" } },
{ age => { extract => "epoch from current_timestamp-confirmed" } },
]
@@ -33,31 +33,31 @@ my $problems = FixMyStreet::App->model("DB::Problem")->search(
$problems = $problems->cursor; # Raw DB cursor for speed
my ( %fixed, %open );
-my @cols = ( 'id', 'council', 'state', 'areas', 'duration', 'age' );
+my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'duration', 'age' );
while ( my @problem = $problems->next ) {
my %problem = zip @cols, @problem;
- my @areas;
- if ( !$problem{council} ) {
- # Problem was not sent to any council, add to all areas
- @areas = grep { $_ } split( /,/, $problem{areas} );
- $problem{councils} = 0;
+ my @bodies;
+ if ( !$problem{bodies_str} ) {
+ # Problem was not sent to any bodies, add to all areas
+ @bodies = grep { $_ } split( /,/, $problem{areas} );
+ $problem{bodies} = 0;
} else {
- # Add to councils it was sent to
- (my $council = $problem{council}) =~ s/\|.*$//;
- @areas = split( /,/, $council );
- $problem{councils} = scalar @areas;
+ # Add to bodies it was sent to
+ (my $bodies = $problem{bodies_str}) =~ s/\|.*$//;
+ @bodies = split( /,/, $bodies );
+ $problem{bodies} = scalar @bodies;
}
- foreach my $council ( @areas ) {
+ foreach my $body ( @bodies ) {
my $duration_str = ( $problem{duration} > 2 * $fourweeks ) ? 'old' : 'new';
my $type = ( $problem{duration} > 2 * $fourweeks )
? 'unknown'
: ($problem{age} > $fourweeks ? 'older' : 'new');
if (FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}}) {
# Fixed problems are either old or new
- $fixed{$council}{$duration_str}++ if FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}};
+ $fixed{$body}{$duration_str}++ if FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}};
} else {
# Open problems are either unknown, older, or new
- $open{$council}{$type}++ if $problem{state} eq 'confirmed';
+ $open{$body}{$type}++ if $problem{state} eq 'confirmed';
}
}
}
diff --git a/db/alert_types.sql b/db/alert_types.sql
index 4116d29dc..1de79e722 100644
--- a/db/alert_types.sql
+++ b/db/alert_types.sql
@@ -83,8 +83,8 @@ insert into alert_type
item_title, item_link, item_description, template)
values ('council_problems', '', '',
'New problems to {{COUNCIL}} on FixMyStreet', '/reports', 'The latest problems for {{COUNCIL}} reported by users',
- 'problem', 'problem.non_public = ''f'' and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (council like ''%''||?||''%''
- or council is null) and areas like ''%,''||?||'',%''', 'created desc',
+ 'problem', 'problem.non_public = ''f'' and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (bodies_str like ''%''||?||''%''
+ or bodies_str is null) and areas like ''%,''||?||'',%''', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-council'
);
@@ -97,8 +97,8 @@ insert into alert_type
values ('ward_problems', '', '',
'New problems for {{COUNCIL}} within {{WARD}} ward on FixMyStreet', '/reports',
'The latest problems for {{COUNCIL}} within {{WARD}} ward reported by users',
- 'problem', 'problem.non_public = ''f'' and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (council like ''%''||?||''%''
- or council is null) and areas like ''%,''||?||'',%''', 'created desc',
+ 'problem', 'problem.non_public = ''f'' and problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (bodies_str like ''%''||?||''%''
+ or bodies_str is null) and areas like ''%,''||?||'',%''', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-ward'
);
diff --git a/db/alert_types_eha.sql b/db/alert_types_eha.sql
index af074717b..e4ec0c986 100644
--- a/db/alert_types_eha.sql
+++ b/db/alert_types_eha.sql
@@ -61,8 +61,8 @@ insert into alert_type
item_title, item_link, item_description, template)
values ('council_problems', '', '',
'New reports to {{COUNCIL}} on reportemptyhomes.com', '/reports', 'The latest reports for {{COUNCIL}} reported by users',
- 'problem', 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (council like ''%''||?||''%''
- or council is null) and areas like ''%,''||?||'',%''', 'created desc',
+ 'problem', 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (bodies_str like ''%''||?||''%''
+ or bodies_str is null) and areas like ''%,''||?||'',%''', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-council'
);
@@ -75,8 +75,8 @@ insert into alert_type
values ('ward_problems', '', '',
'New reports for {{COUNCIL}} within {{WARD}} ward on reportemptyhomes.com', '/reports',
'The latest reports for {{COUNCIL}} within {{WARD}} ward reported by users',
- 'problem', 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (council like ''%''||?||''%''
- or council is null) and areas like ''%,''||?||'',%''', 'created desc',
+ 'problem', 'problem.state in (''confirmed'', ''investigating'', ''planned'', ''in progress'', ''fixed'', ''fixed - council'', ''fixed - user'', ''closed'') and (bodies_str like ''%''||?||''%''
+ or bodies_str is null) and areas like ''%,''||?||'',%''', 'created desc',
'{{title}}, {{confirmed}}', '/report/{{id}}', '{{detail}}', 'alert-problem-ward'
);
diff --git a/db/schema.sql b/db/schema.sql
index 9fd4ce332..1608b08ba 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -124,8 +124,8 @@ create table problem (
postcode text not null,
latitude double precision not null,
longitude double precision not null,
- council text, -- the council(s) we'll report this problem to
- areas text not null, -- the voting areas this location is in
+ bodies_str text, -- the body(s) we'll report this problem to
+ areas text not null, -- the mapit areas this location is in
category text not null default 'Other',
title text not null,
detail text not null,
diff --git a/db/schema_0031-rename-problem-council-column.sql b/db/schema_0031-rename-problem-council-column.sql
new file mode 100644
index 000000000..87542a192
--- /dev/null
+++ b/db/schema_0031-rename-problem-council-column.sql
@@ -0,0 +1,5 @@
+begin;
+
+ALTER TABLE problem RENAME COLUMN council TO bodies_str;
+
+commit;
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm
index 8c37f0f2e..d5bce9283 100644
--- a/perllib/FixMyStreet/App/Controller/Admin.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin.pm
@@ -569,7 +569,7 @@ sub search_reports : Path('search_reports') {
-or => $query,
},
{
- -select => [ 'me.*', qw/problem.council problem.state/ ],
+ -select => [ 'me.*', qw/problem.bodies_str problem.state/ ],
prefetch => [qw/user problem/],
order_by => [\"(me.state='hidden')",\"(problem.state='hidden')",'me.created']
}
diff --git a/perllib/FixMyStreet/App/Controller/Dashboard.pm b/perllib/FixMyStreet/App/Controller/Dashboard.pm
index 00220deff..a355606f4 100644
--- a/perllib/FixMyStreet/App/Controller/Dashboard.pm
+++ b/perllib/FixMyStreet/App/Controller/Dashboard.pm
@@ -109,7 +109,7 @@ sub index : Path : Args(0) {
$c->stash->{category} = $c->req->param('category');
my %where = (
- council => $council, # XXX This will break in a two tier council. Restriction needs looking at...
+ bodies_str => $council, # XXX This will break in a two tier council. Restriction needs looking at...
'problem.state' => [ FixMyStreet::DB::Result::Problem->visible_states() ],
);
$where{areas} = { 'like', '%,' . $c->stash->{ward} . ',%' }
diff --git a/perllib/FixMyStreet/App/Controller/JSON.pm b/perllib/FixMyStreet/App/Controller/JSON.pm
index f3607341a..1a7c1915b 100644
--- a/perllib/FixMyStreet/App/Controller/JSON.pm
+++ b/perllib/FixMyStreet/App/Controller/JSON.pm
@@ -92,7 +92,7 @@ sub problems : Local {
my @problems = $c->cobrand->problems->search( $query, {
order_by => { -asc => 'confirmed' },
columns => [
- 'id', 'title', 'council', 'category',
+ 'id', 'title', 'bodies_str', 'category',
'detail', 'name', 'anonymous', 'confirmed',
'whensent', 'service',
'latitude', 'longitude', 'used_map',
@@ -100,23 +100,13 @@ sub problems : Local {
]
} );
- my @councils;
foreach my $problem (@problems) {
$problem->name( '' ) if $problem->anonymous == 1;
$problem->service( 'Web interface' ) if $problem->service eq '';
- if ($problem->council) {
- (my $council = $problem->council) =~ s/\|.*//g;
- my @council_ids = split /,/, $council;
- push(@councils, @council_ids);
- $problem->council( \@council_ids );
- }
- }
- @councils = uniq @councils;
- my $areas_info = mySociety::MaPit::call('areas', \@councils);
- foreach my $problem (@problems) {
- if ($problem->council) {
- my @council_names = map { $areas_info->{$_}->{name} } @{$problem->council} ;
- $problem->council( join(' and ', @council_names) );
+ my $bodies = $problem->bodies;
+ if (keys %$bodies) {
+ my @body_names = map { $_->name } values %$bodies;
+ $problem->bodies_str( join(' and ', @body_names) );
}
}
diff --git a/perllib/FixMyStreet/App/Controller/Open311.pm b/perllib/FixMyStreet/App/Controller/Open311.pm
index b1e685c1c..62cdaffaf 100644
--- a/perllib/FixMyStreet/App/Controller/Open311.pm
+++ b/perllib/FixMyStreet/App/Controller/Open311.pm
@@ -164,11 +164,11 @@ sub get_services : Private {
if ($lat || $lon) {
my $area_types = $c->cobrand->area_types;
- my $all_councils = mySociety::MaPit::call('point',
+ my $all_areas = mySociety::MaPit::call('point',
"4326/$lon,$lat",
type => $area_types);
$categories = $categories->search( {
- 'body.area_id' => [ keys %$all_councils ],
+ 'body.area_id' => [ keys %$all_areas ],
}, { join => 'body' } );
}
@@ -223,19 +223,11 @@ sub output_requests : Private {
);
my @problemlist;
- my @councils;
while ( my $problem = $problems->next ) {
my $id = $problem->id;
$problem->service( 'Web interface' ) unless $problem->service;
- if ($problem->council) {
- (my $council = $problem->council) =~ s/\|.*//g;
- my @council_ids = split(/,/, $council);
- push(@councils, @council_ids);
- $problem->council( \@council_ids );
- }
-
$problem->state( $statusmap{$problem->state} );
my $request =
@@ -256,7 +248,7 @@ sub output_requests : Private {
'service_code' => [ $problem->category ],
'service_name' => [ $problem->category ],
# 'service_notice' => [ {} ],
- 'agency_responsible' => $problem->council , # FIXME Not according to Open311 v2
+ 'agency_responsible' => $problem->bodies , # FIXME Not according to Open311 v2
# 'zipcode' => [ {} ],
'interface_used' => [ $problem->service ], # Not in Open311 v2
};
@@ -288,12 +280,12 @@ sub output_requests : Private {
}
push(@problemlist, $request);
}
- my $areas_info = mySociety::MaPit::call('areas', \@councils);
+
foreach my $request (@problemlist) {
if ($request->{agency_responsible}) {
- my @council_names = map { $areas_info->{$_}->{name} } @{$request->{agency_responsible}} ;
+ my @body_names = map { $_->name } values %{$request->{agency_responsible}} ;
$request->{agency_responsible} =
- [ {'recipient' => [ @council_names ] } ];
+ [ {'recipient' => [ @body_names ] } ];
}
}
$c->forward( 'format_output', [ {
@@ -319,7 +311,7 @@ sub get_requests : Private {
service_request_id => [ '=', 'id' ],
service_code => [ '=', 'category' ],
status => [ 'IN', 'state' ],
- agency_responsible => [ '~', 'council' ],
+ agency_responsible => [ '~', 'bodies_str' ],
interface_used => [ '=', 'service' ],
has_photo => [ '=', 'photo' ],
);
diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm
index 2c56cd182..41aee3869 100644
--- a/perllib/FixMyStreet/App/Controller/Report.pm
+++ b/perllib/FixMyStreet/App/Controller/Report.pm
@@ -147,7 +147,7 @@ sub format_problem_for_display : Private {
$c->stash->{add_alert} = 1;
}
- $c->stash->{extra_name_info} = $problem->council && $problem->council eq '2482' ? 1 : 0;
+ $c->stash->{extra_name_info} = $problem->bodies_str && $problem->bodies_str eq '2482' ? 1 : 0;
$c->forward('generate_map_tags');
@@ -187,11 +187,10 @@ sub delete :Local :Args(1) {
return $c->res->redirect($uri) unless $c->user_exists;
- my $council = $c->user->obj->from_body;
- return $c->res->redirect($uri) unless $council;
+ my $body = $c->user->obj->from_body;
+ return $c->res->redirect($uri) unless $body;
- my %councils = map { $_ => 1 } @{$p->councils};
- return $c->res->redirect($uri) unless $councils{$council};
+ return $c->res->redirect($uri) unless $p->bodies->{$body};
$p->state('hidden');
$p->lastupdate( \'ms_current_timestamp()' );
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm
index bb8f8f03f..0cb56d67a 100644
--- a/perllib/FixMyStreet/App/Controller/Report/New.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/New.pm
@@ -587,7 +587,7 @@ sub setup_categories_and_bodies : Private {
= $c #
->model('DB::Contact') #
->not_deleted #
- ->search( { body => [ keys %bodies ] } )
+ ->search( { body_id => [ keys %bodies ] } )
->all;
# variables to populate
@@ -816,7 +816,7 @@ sub process_report : Private {
if ( $c->cobrand->moniker eq 'emptyhomes' ) {
$bodies = join( ',', @{ $c->stash->{bodies_to_list} } ) || -1;
- $report->bodies( $bodies );
+ $report->bodies_str( $bodies );
} elsif ( $first_area->{id} == COUNCIL_ID_BARNET ) {
@@ -824,14 +824,14 @@ sub process_report : Private {
unless ( exists Utils::barnet_categories()->{ $report->category } ) {
$c->stash->{field_errors}->{category} = _('Please choose a category');
}
- $report->bodies( $first_area->{id} );
+ $report->bodies_str( $first_area->{id} );
} elsif ( $first_area->{id} != COUNCIL_ID_BROMLEY && $first_area->{type} eq 'LBO') {
unless ( Utils::london_categories()->{ $report->category } ) {
$c->stash->{field_errors}->{category} = _('Please choose a category');
}
- $report->area( $first_area->{id} );
+ $report->bodies_str( $first_area->{id} );
} elsif ( $report->category ) {
@@ -842,14 +842,14 @@ sub process_report : Private {
->not_deleted #
->search(
{
- body => [ keys %$bodies ],
+ body_id => [ keys %$bodies ],
category => $report->category
}
)->all;
unless ( @contacts ) {
$c->stash->{field_errors}->{category} = _('Please choose a category');
- $report->bodies( -1 );
+ $report->bodies_str( -1 );
return 1;
}
@@ -860,7 +860,7 @@ sub process_report : Private {
$body_string .=
'|' . join( ',', @{ $c->stash->{missing_details_bodies} } )
if $body_string && @{ $c->stash->{missing_details_bodies} };
- $report->bodies($body_string);
+ $report->bodies_str($body_string);
my @extra = ();
my $metas = $contacts[0]->extra;
@@ -897,7 +897,7 @@ sub process_report : Private {
# If we're here, we've been submitted somewhere
# where we have no contact information at all.
- $report->bodies( -1 );
+ $report->bodies_str( -1 );
}
@@ -1016,7 +1016,7 @@ sub save_user_and_report : Private {
$report->category( _('Other') ) unless $report->category;
# Set unknown to DB unknown
- $report->bodies( undef ) if $report->bodies eq '-1';
+ $report->bodies_str( undef ) if $report->bodies_str eq '-1';
# if there is a Message Manager message ID, pass it back to the client view
if ($c->cobrand->moniker eq 'fixmybarangay' && $c->req->param('external_source_id')=~/^\d+$/) {
diff --git a/perllib/FixMyStreet/App/Controller/Report/Update.pm b/perllib/FixMyStreet/App/Controller/Report/Update.pm
index c3843c9af..4467a7036 100644
--- a/perllib/FixMyStreet/App/Controller/Report/Update.pm
+++ b/perllib/FixMyStreet/App/Controller/Report/Update.pm
@@ -201,14 +201,14 @@ sub process_update : Private {
if ( $params{state} ) {
$params{state} = 'fixed - council'
- if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_body( $update->problem->council );
+ if $params{state} eq 'fixed' && $c->user && $c->user->belongs_to_body( $update->problem->bodies_str );
$update->problem_state( $params{state} );
}
my @extra; # Next function fills this, but we don't need it here.
# This is just so that the error checkign for these extra fields runs.
# TODO Use extra here as it is used on reports.
- $c->cobrand->process_extras( $c, $update->problem->council, \@extra );
+ $c->cobrand->process_extras( $c, $update->problem->bodies_str, \@extra );
if ( $c->req->param('fms_extra_title') ) {
my %extras = ();
@@ -246,7 +246,7 @@ sub check_for_errors : Private {
# they have to be an authority user to update the state
if ( $c->req->param('state') ) {
my $error = 0;
- $error = 1 unless $c->user && $c->user->belongs_to_body( $c->stash->{update}->problem->council );
+ $error = 1 unless $c->user && $c->user->belongs_to_body( $c->stash->{update}->problem->bodies_str );
my $state = $c->req->param('state');
$error = 1 unless ( grep { $state eq $_ } ( qw/confirmed closed fixed investigating planned/, 'in progress', 'fixed', 'fixed - user', 'fixed - council' ) );
diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm
index ec41dc17f..ec722fd6f 100644
--- a/perllib/FixMyStreet/App/Controller/Reports.pm
+++ b/perllib/FixMyStreet/App/Controller/Reports.pm
@@ -325,7 +325,7 @@ sub load_and_group_problems : Private {
};
if ($c->stash->{ward}) {
$where->{areas} = { 'like', '%,' . $c->stash->{ward}->{id} . ',%' };
- $where->{council} = [
+ $where->{bodies_str} = [
undef,
$c->stash->{council}->{id},
{ 'like', $c->stash->{council}->{id} . ',%' },
@@ -336,7 +336,7 @@ sub load_and_group_problems : Private {
$where->{'lower(external_body)'} = lc $c->stash->{council}->{name};
} elsif ($c->stash->{council}) {
$where->{areas} = { 'like', '%,' . $c->stash->{council}->{id} . ',%' };
- $where->{council} = [
+ $where->{bodies_str} = [
undef,
$c->stash->{council}->{id},
{ 'like', $c->stash->{council}->{id} . ',%' },
@@ -347,7 +347,7 @@ sub load_and_group_problems : Private {
$where,
{
columns => [
- 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand',
+ 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand',
#{ duration => { extract => "epoch from current_timestamp-lastupdate" } },
#{ age => { extract => "epoch from current_timestamp-confirmed" } },
{ confirmed => { extract => 'epoch from confirmed' } },
@@ -364,7 +364,7 @@ sub load_and_group_problems : Private {
my ( %problems, @pins );
my $re_councils = join('|', keys %{$c->stash->{areas_info}});
- my @cols = ( 'id', 'council', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'confirmed', 'whensent', 'lastupdate', 'photo' );
+ my @cols = ( 'id', 'bodies_str', 'state', 'areas', 'latitude', 'longitude', 'title', 'cobrand', 'confirmed', 'whensent', 'lastupdate', 'photo' );
while ( my @problem = $problems->next ) {
my %problem = zip @cols, @problem;
$problem{is_fixed} = FixMyStreet::DB::Result::Problem->fixed_states()->{$problem{state}};
@@ -374,18 +374,19 @@ sub load_and_group_problems : Private {
add_row( \%problem, 0, \%problems, \@pins );
next;
}
- if ( !$problem{council} ) {
- # Problem was not sent to any council, add to possible councils
- $problem{councils} = 0;
+ if ( !$problem{bodies_str} ) {
+ # Problem was not sent to any body, add to possible councils XXX
+ $problem{bodies} = 0;
while ($problem{areas} =~ /,($re_councils)(?=,)/g) {
add_row( \%problem, $1, \%problems, \@pins );
}
} else {
- # Add to councils it was sent to
- (my $council = $problem{council}) =~ s/\|.*$//;
- my @council = split( /,/, $council );
- $problem{councils} = scalar @council;
- foreach ( @council ) {
+ # Add to bodies it was sent to
+ # XXX Assumes body ID matches "council ID"
+ (my $bodies = $problem{bodies_str}) =~ s/\|.*$//;
+ my @bodies = split( /,/, $bodies );
+ $problem{bodies} = scalar @bodies;
+ foreach ( @bodies ) {
next if $_ != $c->stash->{council}->{id};
add_row( \%problem, $_, \%problems, \@pins );
}
diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm
index baaa3b927..b275cfcf7 100755
--- a/perllib/FixMyStreet/App/Controller/Rss.pm
+++ b/perllib/FixMyStreet/App/Controller/Rss.pm
@@ -257,7 +257,7 @@ sub add_row : Private {
my $hashref_restriction = $c->cobrand->site_restriction;
my $base_url = $c->cobrand->base_url;
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} && $row->{council} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{council} && $row->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{council} ) {
$base_url = $c->config->{BASE_URL};
}
my $url = $base_url . $link;
diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm
index 994a245a0..2e3fae72d 100644
--- a/perllib/FixMyStreet/Cobrand/Default.pm
+++ b/perllib/FixMyStreet/Cobrand/Default.pm
@@ -600,10 +600,10 @@ Generate a set of options for council rss alerts.
=cut
sub council_rss_alert_options {
- my ( $self, $all_councils, $c ) = @_;
+ my ( $self, $all_areas, $c ) = @_;
my ( @options, @reported_to_options );
- foreach (values %$all_councils) {
+ foreach (values %$all_areas) {
$_->{short_name} = $self->short_name( $_ );
( $_->{id_name} = $_->{short_name} ) =~ tr/+/_/;
push @options, {
diff --git a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
index b3dbad089..51f368957 100644
--- a/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
+++ b/perllib/FixMyStreet/Cobrand/LichfieldDC.pm
@@ -12,7 +12,7 @@ sub council_url { return 'lichfielddc'; }
# Different to councils parent due to this being a two-tier council. If we get
# more, this can be genericised in the parent.
sub problems_clause {
- return { council => { like => '%2434%' } };
+ return { bodies_str => { like => '%2434%' } };
}
# FIXME - need to double check this is all correct
@@ -27,10 +27,10 @@ sub disambiguate_location {
}
# If we ever link to a county problem report, needs to be to main FixMyStreet
+# XXX Assumes body ID equals mapit area ID
sub base_url_for_report {
my ( $self, $report ) = @_;
- my %councils = map { $_ => 1 } @{$report->councils};
- if ( $councils{2434} ) {
+ if ( $report->bodies->{2434} ) {
return $self->base_url;
} else {
return FixMyStreet->config('BASE_URL');
diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm
index e68d13715..2ed5bffe3 100644
--- a/perllib/FixMyStreet/Cobrand/UK.pm
+++ b/perllib/FixMyStreet/Cobrand/UK.pm
@@ -203,17 +203,17 @@ sub reports_body_check {
sub council_rss_alert_options {
my $self = shift;
- my $all_councils = shift;
- my $c = shift;
+ my $all_areas = shift;
+ my $c = shift;
my %councils = map { $_ => 1 } @{$self->area_types};
- my $num_councils = scalar keys %$all_councils;
+ my $num_councils = scalar keys %$all_areas;
my ( @options, @reported_to_options );
if ( $num_councils == 1 or $num_councils == 2 ) {
my ($council, $ward);
- foreach (values %$all_councils) {
+ foreach (values %$all_areas) {
if ($councils{$_->{type}}) {
$council = $_;
$council->{short_name} = $self->short_name( $council );
@@ -252,7 +252,7 @@ sub council_rss_alert_options {
} elsif ( $num_councils == 4 ) {
# Two-tier council
my ($county, $district, $c_ward, $d_ward);
- foreach (values %$all_councils) {
+ foreach (values %$all_areas) {
$_->{short_name} = $self->short_name( $_ );
( $_->{id_name} = $_->{short_name} ) =~ tr/+/_/;
if ($_->{type} eq 'CTY') {
@@ -323,7 +323,7 @@ sub council_rss_alert_options {
};
} else {
- throw Error::Simple('An area with three tiers of council? Impossible! '. join('|',keys %$all_councils));
+ throw Error::Simple('An area with three tiers of council? Impossible! '. join('|',keys %$all_areas));
}
return ( \@options, @reported_to_options ? \@reported_to_options : undef );
diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
index c7eaf8da0..2b4385a98 100644
--- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm
+++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm
@@ -13,7 +13,7 @@ sub is_council {
sub site_restriction {
my $self = shift;
- return { council => sprintf('%d', $self->council_id) };
+ return { bodies_str => sprintf('%d', $self->council_id) };
}
sub site_key {
my $self = shift;
@@ -27,7 +27,7 @@ sub restriction {
# Different function to site_restriction due to two-tier use
sub problems_clause {
my $self = shift;
- return { council => sprintf('%d', $self->council_id) };
+ return { bodies_str => sprintf('%d', $self->council_id) };
}
sub problems {
@@ -54,7 +54,7 @@ sub enter_postcode_text {
sub area_check {
my ( $self, $params, $context ) = @_;
- my $councils = $params->{all_councils};
+ my $councils = $params->{all_areas};
my $council_match = defined $councils->{$self->council_id};
if ($council_match) {
return 1;
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index ae5815143..2d65c8789 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -24,7 +24,7 @@ __PACKAGE__->add_columns(
{ data_type => "double precision", is_nullable => 0 },
"longitude",
{ data_type => "double precision", is_nullable => 0 },
- "council",
+ "bodies_str",
{ data_type => "text", is_nullable => 1 },
"areas",
{ data_type => "text", is_nullable => 0 },
@@ -122,8 +122,8 @@ __PACKAGE__->belongs_to(
);
-# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-10 15:33:48
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:YZzkUjX7Dsxcsm4bXZjIYg
+# Created by DBIx::Class::Schema::Loader v0.07017 @ 2012-12-13 15:13:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:H2P3Og37G569nQdQA1IWaA
# Add fake relationship to stored procedure table
__PACKAGE__->has_one(
@@ -333,9 +333,9 @@ sub check_for_errors {
$errors{detail} = _('Please enter some details')
unless $self->detail =~ m/\S/;
- $errors{council} = _('No council selected')
- unless $self->council
- && $self->council =~ m/^(?:-1|[\d,]+(?:\|[\d,]+)?)$/;
+ $errors{bodies} = _('No council selected')
+ unless $self->bodies_str
+ && $self->bodies_str =~ m/^(?:-1|[\d,]+(?:\|[\d,]+)?)$/;
if ( !$self->name || $self->name !~ m/\S/ ) {
$errors{name} = _('Please enter your name');
@@ -388,18 +388,19 @@ sub confirm {
return 1;
}
-=head2 councils
+=head2 bodies
-Returns an arrayref of councils to which a report was sent.
+Returns an arrayref of bodies to which a report was sent.
=cut
-sub councils {
+sub bodies($) {
my $self = shift;
- return [] unless $self->council;
- (my $council = $self->council) =~ s/\|.*$//;
- my @council = split( /,/, $council );
- return \@council;
+ return [] unless $self->bodies_str;
+ (my $bodies = $self->bodies_str) =~ s/\|.*$//;
+ my @bodies = split( /,/, $bodies );
+ @bodies = FixMyStreet::App->model('DB::Body')->search({ id => \@bodies })->all;
+ return { map { $_->id => $_ } @bodies };
}
=head2 url
@@ -555,19 +556,18 @@ sub body {
if ($problem->external_body) {
$body = $problem->external_body;
} else {
- my $councils = $problem->councils;
- my $areas_info = mySociety::MaPit::call('areas', $councils);
+ my $bodies = $problem->bodies;
$body = join( _(' and '),
map {
- my $name = $areas_info->{$_}->{name};
+ my $name = $_->name;
if (mySociety::Config::get('AREA_LINKS_FROM_PROBLEMS')) {
'<a href="'
- . $c->uri_for( '/reports/' . $c->cobrand->short_name( $areas_info->{$_} ) )
+ # XXX . $c->uri_for( '/reports/' . $c->cobrand->short_name( $areas_info->{$_} ) )
. '">' . $name . '</a>';
} else {
$name;
}
- } @$councils
+ } values %$bodies
);
}
return $body;
diff --git a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
index 468df2654..be1f6578b 100644
--- a/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/AlertType.pm
@@ -89,7 +89,7 @@ sub email_alerts ($) {
}
my $url = $cobrand->base_url( $row->{alert_cobrand_data} );
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{bodies_str} ) {
$url = mySociety::Config::get('BASE_URL');
}
# this is currently only for new_updates
@@ -166,7 +166,7 @@ sub email_alerts ($) {
};
my $states = "'" . join( "', '", FixMyStreet::DB::Result::Problem::visible_states() ) . "'";
my %data = ( template => $template, data => '', alert_id => $alert->id, alert_email => $alert->user->email, lang => $alert->lang, cobrand => $alert->cobrand, cobrand_data => $alert->cobrand_data );
- my $q = "select problem.id, problem.council, problem.postcode, problem.geocode, problem.title from problem_find_nearby(?, ?, ?) as nearby, problem, users
+ my $q = "select problem.id, problem.bodies_str, problem.postcode, problem.geocode, problem.title from problem_find_nearby(?, ?, ?) as nearby, problem, users
where nearby.problem_id = problem.id
and problem.user_id = users.id
and problem.state in ($states)
@@ -183,7 +183,7 @@ sub email_alerts ($) {
parameter => $row->{id},
} );
my $url = $cobrand->base_url( $alert->cobrand_data );
- if ( $hashref_restriction && $hashref_restriction->{council} && $row->{council} ne $hashref_restriction->{council} ) {
+ if ( $hashref_restriction && $hashref_restriction->{bodies_str} && $row->{bodies_str} ne $hashref_restriction->{bodies_str} ) {
$url = mySociety::Config::get('BASE_URL');
}
$data{data} .= $url . "/report/" . $row->{id} . " - $row->{title}\n\n";
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
index 4d8004024..16eca144d 100644
--- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm
+++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm
@@ -228,7 +228,7 @@ sub send_reports {
my $unsent = FixMyStreet::App->model("DB::Problem")->search( {
state => [ 'confirmed', 'fixed' ],
whensent => undef,
- bodies => { '!=', undef },
+ bodies_str => { '!=', undef },
} );
my (%notgot, %note);
@@ -292,7 +292,7 @@ sub send_reports {
my ( $sender_count );
if ($site eq 'emptyhomes') {
- my $body = $row->bodies;
+ my $body = $row->bodies_str;
$body = FixMyStreet::App->model("DB::Body")->find($body);
my $sender = "FixMyStreet::SendReport::EmptyHomes";
$reporters{ $sender } = $sender->new() unless $reporters{$sender};
@@ -302,7 +302,7 @@ sub send_reports {
# XXX Needs locks!
# XXX Only copes with at most one missing body
- my ($bodies, $missing) = $row->bodies =~ /^([\d,]+)(?:\|(\d+))?/;
+ my ($bodies, $missing) = $row->bodies_str =~ /^([\d,]+)(?:\|(\d+))?/;
my @bodies = split(/,/, $bodies);
$bodies = FixMyStreet::App->model("DB::Body")->search({ id => \@bodies });
$missing = FixMyStreet::App->model("DB::Body")->find($missing);
@@ -362,7 +362,7 @@ sub send_reports {
if (mySociety::Config::get('STAGING_SITE')) {
# on a staging server send emails to ourselves rather than the bodies
my @testing_bodies = split( '\|', mySociety::Config::get('TESTING_COUNCILS') );
- unless ( grep { $row->bodies eq $_ } @testing_bodies ) {
+ unless ( grep { $row->bodies_str eq $_ } @testing_bodies ) {
%reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::(Email|NI)/ } keys %reporters;
unless (%reporters) {
%reporters = ( 'FixMyStreet::SendReport::Email' => FixMyStreet::SendReport::Email->new() );
@@ -424,7 +424,7 @@ sub send_reports {
my $unsent = FixMyStreet::App->model("DB::Problem")->search( {
state => [ 'confirmed', 'fixed' ],
whensent => undef,
- bodies => { '!=', undef },
+ bodies_str => { '!=', undef },
send_fail_count => { '>', 0 }
} );
while (my $row = $unsent->next) {
diff --git a/perllib/FixMyStreet/SendReport/Email.pm b/perllib/FixMyStreet/SendReport/Email.pm
index a39760509..5277b639a 100644
--- a/perllib/FixMyStreet/SendReport/Email.pm
+++ b/perllib/FixMyStreet/SendReport/Email.pm
@@ -26,7 +26,7 @@ sub build_recipient_list {
unless ($confirmed) {
$all_confirmed = 0;
- $note = 'Body ' . $row->bodies . ' deleted'
+ $note = 'Body ' . $row->bodies_str . ' deleted'
unless $note;
$body_email = 'N/A' unless $body_email;
$self->unconfirmed_counts->{$body_email}{$row->category}++;
@@ -45,7 +45,7 @@ sub get_template {
my ( $self, $row ) = @_;
my $template = 'submit.txt';
- $template = 'submit-brent.txt' if $row->bodies eq 2488 || $row->bodies eq 2237;
+ $template = 'submit-brent.txt' if $row->bodies_str eq 2488 || $row->bodies_str eq 2237;
my $template_path = FixMyStreet->path_to( "templates", "email", $row->cobrand, $row->lang, $template )->stringify;
$template_path = FixMyStreet->path_to( "templates", "email", $row->cobrand, $template )->stringify
unless -e $template_path;
diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm
index f0a76d0fb..c6d838998 100644
--- a/perllib/FixMyStreet/SendReport/Open311.pm
+++ b/perllib/FixMyStreet/SendReport/Open311.pm
@@ -40,7 +40,7 @@ sub send {
my $revert = 0;
# Extra bromley fields
- if ( $row->bodies == 2482 ) {
+ if ( $row->bodies_str == 2482 ) {
$revert = 1;
@@ -90,12 +90,12 @@ sub send {
);
# non standard west berks end points
- if ( $row->bodies =~ /2619/ ) {
+ if ( $row->bodies_str =~ /2619/ ) {
$open311->endpoints( { services => 'Services', requests => 'Requests' } );
}
# required to get round issues with CRM constraints
- if ( $row->bodies =~ /2218/ ) {
+ if ( $row->bodies_str =~ /2218/ ) {
$row->user->name( $row->user->id . ' ' . $row->user->name );
$revert = 1;
}
@@ -124,7 +124,7 @@ sub send {
} else {
$result *= 1;
# temporary fix to resolve some issues with west berks
- if ( $row->bodies =~ /2619/ ) {
+ if ( $row->bodies_str =~ /2619/ ) {
$result *= 0;
}
}
diff --git a/perllib/FixMyStreet/TestMech.pm b/perllib/FixMyStreet/TestMech.pm
index 7f81c0fc2..30807c4e2 100644
--- a/perllib/FixMyStreet/TestMech.pm
+++ b/perllib/FixMyStreet/TestMech.pm
@@ -519,11 +519,11 @@ sub get_ok_json {
return decode_json( $res->content );
}
-sub delete_problems_for_council {
+sub delete_problems_for_body {
my $mech = shift;
- my $council = shift;
+ my $body = shift;
- my $reports = FixMyStreet::App->model('DB::Problem')->search( { council => $council } );
+ my $reports = FixMyStreet::App->model('DB::Problem')->search( { bodies_str => $body } );
if ( $reports ) {
for my $r ( $reports->all ) {
$r->comments->delete;
@@ -532,8 +532,8 @@ sub delete_problems_for_council {
}
}
-sub create_problems_for_council {
- my ( $mech, $count, $council, $title, $params ) = @_;
+sub create_problems_for_body {
+ my ( $mech, $count, $body, $title, $params ) = @_;
my $dt = $params->{dt} || DateTime->now();
@@ -549,11 +549,11 @@ sub create_problems_for_council {
while ($count) {
my $default_params = {
postcode => 'SW1A 1AA',
- council => $council,
+ bodies_str => $body,
areas => ',105255,11806,11828,2247,2504,',
category => 'Other',
- title => "$title Test $count for $council",
- detail => "$title Test $count for $council Detail",
+ title => "$title Test $count for $body",
+ detail => "$title Test $count for $body Detail",
used_map => 't',
name => 'Test User',
anonymous => 'f',
diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm
index 81b50406b..4e64e350f 100644
--- a/perllib/Open311/GetServiceRequestUpdates.pm
+++ b/perllib/Open311/GetServiceRequestUpdates.pm
@@ -14,7 +14,7 @@ has verbose => ( is => 'ro', default => 0 );
sub fetch {
my $self = shift;
- my $councils = FixMyStreet::App->model('DB::Body')->search(
+ my $bodies = FixMyStreet::App->model('DB::Body')->search(
{
send_method => 'Open311',
send_comments => 1,
@@ -23,24 +23,24 @@ sub fetch {
}
);
- while ( my $council = $councils->next ) {
+ while ( my $body = $bodies->next ) {
my $o = Open311->new(
- endpoint => $council->endpoint,
- api_key => $council->api_key,
- jurisdiction => $council->jurisdiction,
+ endpoint => $body->endpoint,
+ api_key => $body->api_key,
+ jurisdiction => $body->jurisdiction,
);
- if ( $council->area_id =~ /2482/ ) {
+ if ( $body->area_id == 2482 ) {
my $endpoints = $o->endpoints;
$endpoints->{update} = 'update.xml';
$endpoints->{service_request_updates} = 'update.xml';
$o->endpoints( $endpoints );
}
- $self->suppress_alerts( $council->suppress_alerts );
- $self->system_user( $council->comment_user );
- $self->update_comments( $o, { areaid => $council->area_id }, );
+ $self->suppress_alerts( $body->suppress_alerts );
+ $self->system_user( $body->comment_user );
+ $self->update_comments( $o, { areaid => $body->area_id }, );
}
}
@@ -83,7 +83,7 @@ sub update_comments {
FixMyStreet::App->model('DB::Problem')
->search( {
external_id => $request_id,
- council => { like => '%' . $council_details->{areaid} . '%' },
+ bodies_str => { like => '%' . $council_details->{areaid} . '%' },
} );
if (my $p = $problem->first) {
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t
index 71a391c59..9cea85861 100644
--- a/t/app/controller/admin.t
+++ b/t/app/controller/admin.t
@@ -45,7 +45,7 @@ my $dt = DateTime->new(
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
{
postcode => 'SW1A 1AA',
- council => '2504',
+ bodies_str => '2504',
areas => ',105255,11806,11828,2247,2504,',
category => 'Other',
title => 'Report to Edit',
@@ -84,7 +84,7 @@ subtest 'check summary counts' => sub {
my $problem_count = $problems->count;
$problems->update( { cobrand => '' } );
- FixMyStreet::App->model('DB::Problem')->search( { council => 2489 } )->update( { council => 1 } );
+ FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 2489 } )->update( { bodies_str => 1 } );
my $q = FixMyStreet::App->model('DB::Questionnaire')->find_or_new( { problem => $report, });
$q->whensent( \'ms_current_timestamp()' );
@@ -118,7 +118,7 @@ subtest 'check summary counts' => sub {
my ($num_alerts) = $mech->content =~ /(\d+) confirmed alerts/;
my ($num_qs) = $mech->content =~ /(\d+) questionnaires sent/;
- $report->council(2489);
+ $report->bodies_str(2489);
$report->cobrand('barnet');
$report->update;
@@ -131,7 +131,7 @@ subtest 'check summary counts' => sub {
$mech->content_contains( ($num_alerts+1) . " confirmed alerts" );
$mech->content_contains( ($num_qs+1) . " questionnaires sent" );
- $report->council(2504);
+ $report->bodies_str(2504);
$report->cobrand('');
$report->update;
@@ -139,7 +139,7 @@ subtest 'check summary counts' => sub {
$alert->update;
}
- FixMyStreet::App->model('DB::Problem')->search( { council => 1 } )->update( { council => 2489 } );
+ FixMyStreet::App->model('DB::Problem')->search( { bodies_str => 1 } )->update( { bodies_str => 2489 } );
ok $mech->host('fixmystreet.com');
};
diff --git a/t/app/controller/alert_new.t b/t/app/controller/alert_new.t
index c849b9485..6f130279b 100644
--- a/t/app/controller/alert_new.t
+++ b/t/app/controller/alert_new.t
@@ -382,7 +382,7 @@ subtest "Test normal alert signups and that alerts are sent" => sub {
my $report_time = '2011-03-01 12:00:00';
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- council => '2651',
+ bodies_str => '2651',
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Testing',
@@ -532,7 +532,7 @@ for my $test (
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- council => '2651',
+ bodies_str => '2651',
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Alert test for non public reports',
@@ -590,7 +590,7 @@ subtest 'check new updates alerts for non public reports only go to report owner
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create( {
postcode => 'EH1 1BB',
- council => '2651',
+ bodies_str => '2651',
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Alert test for non public reports',
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
index d973543ce..0f01a9ea9 100644
--- a/t/app/controller/around.t
+++ b/t/app/controller/around.t
@@ -90,7 +90,7 @@ subtest 'check non public reports are not displayed on around page' => sub {
longitude => -3.17492254484,
};
my @edinburgh_problems =
- $mech->create_problems_for_council( 5, 2651, 'Around page', $params );
+ $mech->create_problems_for_body( 5, 2651, 'Around page', $params );
$mech->get_ok('/');
$mech->submit_form_ok( { with_fields => { pc => 'EH99 1SP' } },
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
index 462b21064..47c08291f 100644
--- a/t/app/controller/index.t
+++ b/t/app/controller/index.t
@@ -55,12 +55,12 @@ subtest "does pc, (x,y), (e,n) or (lat,lon) go to /around" => sub {
}
};
-$mech->delete_problems_for_council( 2651 );
+$mech->delete_problems_for_body( 2651 );
my $problem_rs = FixMyStreet::App->model('DB::Problem');
my $num = $problem_rs->count;
-my @edinburgh_problems = $mech->create_problems_for_council(5, 2651, 'Front page');
+my @edinburgh_problems = $mech->create_problems_for_body(5, 2651, 'Front page');
is scalar @edinburgh_problems, 5, 'correct number of edinburgh problems created';
$mech->get_ok('/report/' . $edinburgh_problems[2]->id);
diff --git a/t/app/controller/json.t b/t/app/controller/json.t
index 468fa5b31..e8f9c0e09 100644
--- a/t/app/controller/json.t
+++ b/t/app/controller/json.t
@@ -47,7 +47,7 @@ my $user = $mech->create_user_ok('test@example.com');
my $problem_args = {
postcode => 'sw1a 1aa',
- council => '2501',
+ bodies_str => '2501',
areas => ',105164,11806,11827,2247,2501,34817,42011,66045,70786,8519,',
category => 'test category',
title => 'Test title',
diff --git a/t/app/controller/questionnaire.t b/t/app/controller/questionnaire.t
index 3a6a3d6ad..a99f4c645 100644
--- a/t/app/controller/questionnaire.t
+++ b/t/app/controller/questionnaire.t
@@ -30,7 +30,7 @@ my $sent_time = $sent->ymd . ' ' . $sent->hms;
my $report = FixMyStreet::App->model('DB::Problem')->find_or_create(
{
postcode => 'EH1 1BB',
- council => '2651',
+ bodies_str => '2651',
areas => ',11808,135007,14419,134935,2651,20728,',
category => 'Street lighting',
title => 'Testing',
diff --git a/t/app/controller/report_display.t b/t/app/controller/report_display.t
index 39f1b59a7..b20fe4077 100644
--- a/t/app/controller/report_display.t
+++ b/t/app/controller/report_display.t
@@ -377,7 +377,7 @@ for my $test (
$user->update;
$report->discard_changes;
- $report->council( $test->{report_council} );
+ $report->bodies_str( $test->{report_council} );
$report->update;
$mech->get_ok("/report/$report_id");
@@ -391,7 +391,7 @@ for my $test (
}
$report->discard_changes;
-$report->council( 2504 );
+$report->bodies_str( 2504 );
$report->update;
# tidy up
diff --git a/t/app/controller/report_interest_count.t b/t/app/controller/report_interest_count.t
index 0a8a5ac0b..788d2c473 100644
--- a/t/app/controller/report_interest_count.t
+++ b/t/app/controller/report_interest_count.t
@@ -85,7 +85,7 @@ SKIP: {
$user->update;
$report->discard_changes;
- $report->council( $test->{report_council} );
+ $report->bodies_str( $test->{report_council} );
$report->update;
$mech->get_ok("/report/$report_id");
@@ -135,7 +135,7 @@ subtest 'check support details not shown if not enabled in cobrand' => sub {
};
$report->discard_changes;
-$report->council( 2504 );
+$report->bodies_str( 2504 );
$report->update;
# tidy up
diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t
index 92943bde9..323abfa18 100644
--- a/t/app/controller/report_new.t
+++ b/t/app/controller/report_new.t
@@ -503,7 +503,7 @@ foreach my $test (
is $mech->get( '/report/' . $report->id )->code, 404, "report not found";
# Check the report has been assigned appropriately
- is $report->council, 2651;
+ is $report->bodies_str, 2651;
# receive token
my $email = $mech->get_email;
@@ -659,7 +659,7 @@ subtest "test report creation for a user who is signing in as they report" => su
is $mech->uri->path, "/report/" . $report->id, "redirected to report page";
# Check the report has been assigned appropriately
- is $report->council, 2651;
+ is $report->bodies_str, 2651;
# check that no emails have been sent
$mech->email_count_is(0);
@@ -750,7 +750,7 @@ foreach my $test (
ok $report, "Found the report";
# Check the report has been assigned appropriately
- is $report->council, $test->{council};
+ is $report->bodies_str, $test->{council};
# check that we got redirected to /report/
is $mech->uri->path, "/report/" . $report->id, "redirected to report page";
@@ -1116,7 +1116,7 @@ SKIP: {
ok $report, "Found the report";
# Check the report has been assigned appropriately
- is $report->council, 2240;
+ is $report->bodies_str, 2240;
# receive token
my $email = $mech->get_email;
diff --git a/t/app/controller/report_updates.t b/t/app/controller/report_updates.t
index 2c7294222..2d49d3eef 100644
--- a/t/app/controller/report_updates.t
+++ b/t/app/controller/report_updates.t
@@ -553,7 +553,7 @@ for my $test (
subtest $test->{desc} => sub {
$report->comments->delete;
if ( $test->{ report_councils } ) {
- $report->council( $test->{ report_councils } );
+ $report->bodies_str( $test->{ report_councils } );
$report->update;
}
@@ -633,7 +633,7 @@ $user->from_body(0);
$user->update;
$report->state('confirmed');
-$report->council('2504');
+$report->bodies_str('2504');
$report->update;
for my $test (
diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t
index a4dab6597..74e4e3d71 100644
--- a/t/app/controller/reports.t
+++ b/t/app/controller/reports.t
@@ -8,11 +8,11 @@ use DateTime;
ok( my $mech = FixMyStreet::TestMech->new, 'Created mech object' );
-$mech->delete_problems_for_council( 2504 );
-$mech->delete_problems_for_council( 2651 );
+$mech->delete_problems_for_body( 2504 );
+$mech->delete_problems_for_body( 2651 );
-my @edinburgh_problems = $mech->create_problems_for_council(3, 2651, 'All reports');
-my @westminster_problems = $mech->create_problems_for_council(5, 2504, 'All reports');
+my @edinburgh_problems = $mech->create_problems_for_body(3, 2651, 'All reports');
+my @westminster_problems = $mech->create_problems_for_body(5, 2504, 'All reports');
is scalar @westminster_problems, 5, 'correct number of westminster problems created';
is scalar @edinburgh_problems, 3, 'correct number of edinburgh problems created';
diff --git a/templates/web/bromley/report/display.html b/templates/web/bromley/report/display.html
index 986871a08..82d2e1a4b 100644
--- a/templates/web/bromley/report/display.html
+++ b/templates/web/bromley/report/display.html
@@ -74,7 +74,7 @@
<br><a href="http://www.bromley.gov.uk/report">Report a different issue</a>
</div>
- [% IF c.user && c.user.belongs_to_body( problem.council ) %]
+ [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %]
<label for="form_state">[% loc( 'State' ) %]</label>
<select name="state" id="form_state">
[% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
diff --git a/templates/web/bromley/report/new/fill_in_details_form.html b/templates/web/bromley/report/new/fill_in_details_form.html
index 2c5abb874..b60935f47 100644
--- a/templates/web/bromley/report/new/fill_in_details_form.html
+++ b/templates/web/bromley/report/new/fill_in_details_form.html
@@ -39,8 +39,8 @@
[% INCLUDE 'report/new/form_heading.html' %]
- [% IF field_errors.council %]
- <p class='form-error'>[% field_errors.council %]</p>
+ [% IF field_errors.bodies %]
+ <p class='form-error'>[% field_errors.bodies %]</p>
[% END %]
diff --git a/templates/web/default/admin/list_updates.html b/templates/web/default/admin/list_updates.html
index 33b53770f..d09205380 100644
--- a/templates/web/default/admin/list_updates.html
+++ b/templates/web/default/admin/list_updates.html
@@ -29,7 +29,7 @@
<td>[% PROCESS format_time time=update.created %]</td>
<td>[% IF update.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
<td>[% IF update.user.id == update.problem.user_id %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
- <td>[% IF update.user.belongs_to_body( update.problem.council ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
+ <td>[% IF update.user.belongs_to_body( update.problem.bodies_str ) %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
<td>[% update.cobrand %]<br>[% update.cobrand_data | html %]</td>
<td>[% update.text | html %]</td>
<td><a href="[% c.uri_for( 'update_edit', update.id ) %]">[% loc('Edit') %]</a></td>
diff --git a/templates/web/default/admin/problem_row.html b/templates/web/default/admin/problem_row.html
index 22825429a..ce95f8078 100644
--- a/templates/web/default/admin/problem_row.html
+++ b/templates/web/default/admin/problem_row.html
@@ -11,9 +11,9 @@
<td>[% PROCESS value_or_nbsp value=problem.name %]</td>
<td>[% PROCESS value_or_nbsp value=problem.user.email %]</td>
<td>[%- IF edit_council_contacts -%]
- <a href="[% c.uri_for('council_contacts', problem.council ) %]">[% PROCESS value_or_nbsp value=problem.council %]</a>
+ <a href="[% c.uri_for('council_contacts', problem.bodies_str ) %]">[% PROCESS value_or_nbsp value=problem.bodies_str %]</a>
[%- ELSE -%]
- [%- PROCESS value_or_nbsp value=problem.council -%]
+ [%- PROCESS value_or_nbsp value=problem.bodies_str -%]
[%- END -%]</td>
<td>[% PROCESS value_or_nbsp value=problem.category %]</td>
<td>[% IF problem.anonymous %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td>
diff --git a/templates/web/default/admin/report_edit.html b/templates/web/default/admin/report_edit.html
index ea98a9be9..9cd2c1d8c 100644
--- a/templates/web/default/admin/report_edit.html
+++ b/templates/web/default/admin/report_edit.html
@@ -13,7 +13,7 @@
<li><label for='title'>[% loc('Subject:') %]</label> <input size=60 type='text' id='title' name='title' value='[% problem.title | html %]'></li>
<li><label for='detail'>[% loc('Details:') %]</label><br><textarea name='detail' id='detail' cols=60 rows=10>[% problem.detail | html %]</textarea></li>
<li>[% loc('Co-ordinates:') %] [% problem.latitude %], [% problem.longitude %] ( [% loc('originally entered') %] [% problem.postcode | html %] , [% IF problem.used_map %][% loc('used map') %][% ELSE %][% loc("didn't use map") %][% END %])</li>
-<li>[% loc('For council(s):') %] [% IF problem.council %][% problem.council %][% ELSE %]<em>[% loc('None' ) %]</em>[% END %] ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])</li>
+<li>[% loc('For council(s):') %] [% IF problem.bodies_str %][% problem.bodies_str %][% ELSE %]<em>[% loc('None' ) %]</em>[% END %] ([% loc('other areas:') %] [% problem.areas | remove('^,') | remove( ',$' ) %])</li>
<li><label for="state">[% loc('State:') %]</label> <select name="state" id="state">
[% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
loc('Investigating')], ['planned', loc('Planned')], ['in progress',
diff --git a/templates/web/default/admin/timeline.html b/templates/web/default/admin/timeline.html
index 95120e48c..db6ff83ef 100644
--- a/templates/web/default/admin/timeline.html
+++ b/templates/web/default/admin/timeline.html
@@ -25,7 +25,7 @@
[% CASE 'problemConfirmed' %]
[%- tprintf( loc('Problem %s confirmed'), '<a href="' _ c.uri_for_email( '/report', item.obj.id, c.cobrand_data ) _ '">' _ item.obj.id _ '</a>') %]; [% PROCESS problem_name problem=item.obj -%]
[% CASE 'problemSent' %]
- [% tprintf(loc("Problem %s sent to council %s"), '<a href="' _ c.uri_for_email( '/report', item.obj.id, c.cobrand_data ) _ '">' _ item.obj.id _ '</a>', item.obj.council ) %]
+ [% tprintf(loc("Problem %s sent to council %s"), '<a href="' _ c.uri_for_email( '/report', item.obj.id, c.cobrand_data ) _ '">' _ item.obj.id _ '</a>', item.obj.bodies_str ) %]
[% CASE 'quesSent' %]
[% tprintf(loc("Questionnaire %d sent for problem %d"), item.obj.id, item.obj.problem_id ) %]
[% CASE 'quesAnswered' %]
diff --git a/templates/web/default/admin/update_edit.html b/templates/web/default/admin/update_edit.html
index b56ceeae3..c0db82f28 100644
--- a/templates/web/default/admin/update_edit.html
+++ b/templates/web/default/admin/update_edit.html
@@ -22,7 +22,7 @@
</select></li>
<li>[% loc('Name:') %] <input type='text' name='name' id='name' value='[% update.name | html %]'></li>
<li>[% loc('Email:') %] <input type='text' id='email' name='email' value='[% update.user.email | html %]'>
-[%- IF update.user.from_body && update.user.from_body == update.problem.council %]
+[%- IF update.user.from_body && update.user.from_body == update.problem.bodies_str %]
[% ' (' _ tprintf(loc('user is from same council as problem - %d'), update.user.from_body ) _')' %]
[% END -%]
[%- IF update.user.id == update.problem.user.id %]
diff --git a/templates/web/default/questionnaire/completed.html b/templates/web/default/questionnaire/completed.html
index 52c20652c..4d848a63c 100644
--- a/templates/web/default/questionnaire/completed.html
+++ b/templates/web/default/questionnaire/completed.html
@@ -22,7 +22,7 @@ site and leave an update.</p>') %]
[% END %]
[% IF advert_outcome %]
- [% display_crosssell_advert( problem.user.email, problem.name, 'council', problem.council ) %]
+ [% display_crosssell_advert( problem.user.email, problem.name, 'council', problem.bodies_str ) %]
[% END %]
[% INCLUDE 'footer.html' %]
diff --git a/templates/web/default/report/_main.html b/templates/web/default/report/_main.html
index b9779db69..9b637b83c 100644
--- a/templates/web/default/report/_main.html
+++ b/templates/web/default/report/_main.html
@@ -4,7 +4,7 @@
<p><em>
[% problem.meta_line(c) | html %]
[%- IF !problem.used_map %]; <strong>[% loc('there is no pin shown as the user did not use the map') %]</strong>[% END %]
- [% IF problem.council %]
+ [% IF problem.bodies_str %]
[% IF problem.whensent || problem.can_display_external_id %]
<small class="council_sent_info"><br>
[% problem.processed_summary_string(c) %]
diff --git a/templates/web/default/report/new/fill_in_details_form.html b/templates/web/default/report/new/fill_in_details_form.html
index 9c9451914..4af0baccd 100644
--- a/templates/web/default/report/new/fill_in_details_form.html
+++ b/templates/web/default/report/new/fill_in_details_form.html
@@ -40,8 +40,8 @@
-[% IF field_errors.council %]
- <div class='form-error'>[% field_errors.council %]</div>
+[% IF field_errors.bodies %]
+ <div class='form-error'>[% field_errors.bodies %]</div>
[% END %]
[% IF field_errors.title %]
diff --git a/templates/web/default/report/update-form.html b/templates/web/default/report/update-form.html
index 48eb60fcb..957fc9947 100644
--- a/templates/web/default/report/update-form.html
+++ b/templates/web/default/report/update-form.html
@@ -23,7 +23,7 @@
<textarea name="update" id="form_update" rows="7" cols="30" required>[% update.text | html %]</textarea>
</div>
- [% IF c.user && c.user.belongs_to_body( problem.council ) %]
+ [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %]
<div class="form-field">
<label for="form_state">[% loc( 'State:' ) %]</label>
<select name="state" id="form_state">
diff --git a/templates/web/default/reports/_list-entry.html b/templates/web/default/reports/_list-entry.html
index 14863c4a1..fa7dcee7b 100755
--- a/templates/web/default/reports/_list-entry.html
+++ b/templates/web/default/reports/_list-entry.html
@@ -1,6 +1,6 @@
<li><a href="[% c.uri_for('/report/' _ problem.id) %]">[% problem.title | html %]</a>
- [% IF problem.councils > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %]
+ [% IF problem.bodies > 1 %] <small>[% loc('(sent to both)') %]</small> [% END %]
[% IF c.cobrand.moniker != 'emptyhomes' %]
- [% IF problem.councils == 0 %] <small>[% loc('(not sent to council)') %]</small> [% END %]
+ [% IF problem.bodies == 0 %] <small>[% loc('(not sent to council)') %]</small> [% END %]
[% END %]
</li>
diff --git a/templates/web/default/tokens/confirm_problem.html b/templates/web/default/tokens/confirm_problem.html
index b6d82968f..b44214c8b 100644
--- a/templates/web/default/tokens/confirm_problem.html
+++ b/templates/web/default/tokens/confirm_problem.html
@@ -14,7 +14,7 @@ You can <a href="[% c.cobrand.base_url_for_report( problem ) %][% problem.url %]
[%
loc('You have successfully confirmed your problem');
- IF problem.council;
+ IF problem.bodies_str;
loc(' and <strong>we will now send it to the council</strong>');
END;
diff --git a/templates/web/emptyhomes/report/display.html b/templates/web/emptyhomes/report/display.html
index 545a4ca44..911908d2b 100644
--- a/templates/web/emptyhomes/report/display.html
+++ b/templates/web/emptyhomes/report/display.html
@@ -16,7 +16,7 @@
<h1>Empty property report</h1>
<p><em>[% problem.meta_line(c) | html %]
-[% IF problem.council %]
+[% IF problem.bodies_str %]
[% IF problem.whensent %]
<small class="council_sent_info"><br>[% problem.duration_string(c) %]</small>
[% END %]
diff --git a/templates/web/emptyhomes/tokens/confirm_problem.html b/templates/web/emptyhomes/tokens/confirm_problem.html
index 7bcf8acdf..5e77ca59f 100644
--- a/templates/web/emptyhomes/tokens/confirm_problem.html
+++ b/templates/web/emptyhomes/tokens/confirm_problem.html
@@ -2,7 +2,7 @@
<h1>[% loc('Confirmation') %]</h1>
-[% IF problem.council %]
+[% IF problem.bodies_str %]
<p>[%
loc(
'Thank you for reporting an empty property on ReportEmptyHomes.com. We have emailed the lead officer for empty homes in the council responsible with details, and asked them to do whatever they can to get the empty property back into use as soon as possible.'
diff --git a/templates/web/fixmystreet/report/_item.html b/templates/web/fixmystreet/report/_item.html
index 6014074e0..894090f98 100644
--- a/templates/web/fixmystreet/report/_item.html
+++ b/templates/web/fixmystreet/report/_item.html
@@ -13,8 +13,8 @@
[%- IF include_lastupdate AND problem.confirmed != problem.lastupdate AND problem.whensent != problem.lastupdate %], last updated [% prettify_epoch( problem.lastupdate, 1 ) %]
[%- END %]
[% IF include_lastupdate %]
- [% IF problem.councils > 1 %] [% loc('(sent to both)') %]
- [% ELSIF problem.councils == 0 %] [% loc('(not sent to council)') %]
+ [% IF problem.bodies > 1 %] [% loc('(sent to both)') %]
+ [% ELSIF problem.bodies == 0 %] [% loc('(not sent to council)') %]
[% END %]
[% END %]
[% IF NOT no_fixed AND problem.is_fixed %]
diff --git a/templates/web/fixmystreet/report/new/fill_in_details_form.html b/templates/web/fixmystreet/report/new/fill_in_details_form.html
index 8f5251f78..ceba7a6ba 100644
--- a/templates/web/fixmystreet/report/new/fill_in_details_form.html
+++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html
@@ -51,8 +51,8 @@
[% INCLUDE 'report/new/form_heading.html' %]
- [% IF field_errors.council %]
- <p class='form-error'>[% field_errors.council %]</p>
+ [% IF field_errors.bodies %]
+ <p class='form-error'>[% field_errors.bodies %]</p>
[% END %]
diff --git a/templates/web/fixmystreet/report/update-form.html b/templates/web/fixmystreet/report/update-form.html
index 0c076f5c4..ec5d57b2d 100644
--- a/templates/web/fixmystreet/report/update-form.html
+++ b/templates/web/fixmystreet/report/update-form.html
@@ -22,7 +22,7 @@
[% END %]
<textarea rows="7" cols="30" name="update" id="form_update" placeholder="[% loc('Please write your update here') %]" required>[% update.text | html %]</textarea>
- [% IF c.user && c.user.belongs_to_body( problem.council ) %]
+ [% IF c.user && c.user.belongs_to_body( problem.bodies_str ) %]
<label for="form_state">[% loc( 'State' ) %]</label>
<select name="state" id="form_state">
[% FOREACH state IN [ ['confirmed', loc('Open')], ['investigating',
@@ -135,7 +135,7 @@
[% IF field_errors.name %]
<p class='form-error'>[% field_errors.name %]</p>
[% END %]
- <input type="text" [% IF problem.council == '2482' %]class="validName" [% END %]name="name" id="form_name" value="[% update.name || c.user.name | html %]" placeholder="[% loc('Your name') %]">
+ <input type="text" [% IF problem.bodies_str == '2482' %]class="validName" [% END %]name="name" id="form_name" value="[% update.name || c.user.name | html %]" placeholder="[% loc('Your name') %]">
<div class="checkbox-group">
<input type="checkbox" name="may_show_name" id="form_may_show_name" value="1"[% ' checked' UNLESS update.anonymous %]>
diff --git a/templates/web/fixmystreet/report/updates-sidebar-notes.html b/templates/web/fixmystreet/report/updates-sidebar-notes.html
index e59d61fec..bdbcae518 100644
--- a/templates/web/fixmystreet/report/updates-sidebar-notes.html
+++ b/templates/web/fixmystreet/report/updates-sidebar-notes.html
@@ -1,5 +1,5 @@
<p>
- [% IF ( problem.council != '2482' AND !problem.council.match('2347') ) OR problem.send_method_used != 'Open311' %]
+ [% IF ( problem.bodies_str != '2482' AND !problem.bodies_str.match('2347') ) OR problem.send_method_used != 'Open311' %]
[% loc( 'Please note that updates are not sent to the council.' ) %]
[% END %]
[% loc( 'Your information will only be used in accordance with our <a href="/privacy">privacy policy</a>' ) %]</p>
diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html
index a4029c527..1fee02717 100644
--- a/templates/web/zurich/report/new/fill_in_details_form.html
+++ b/templates/web/zurich/report/new/fill_in_details_form.html
@@ -49,8 +49,8 @@
[% INCLUDE 'report/new/form_heading.html' %]
- [% IF field_errors.council %]
- <p class='form-error'>[% field_errors.council %]</p>
+ [% IF field_errors.bodies %]
+ <p class='form-error'>[% field_errors.bodies %]</p>
[% END %]
<label for="form_detail">[% loc('Details') %]</label>