diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Location.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UK.pm | 9 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/UKCouncils.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Map/UKCouncilWMTS.pm | 1 | ||||
-rw-r--r-- | t/app/controller/admin/users.t | 5 | ||||
-rw-r--r-- | t/cobrand/cheshireeast.t | 3 |
7 files changed, 15 insertions, 13 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Location.pm b/perllib/FixMyStreet/App/Controller/Location.pm index 81c2c33fc..416fb942a 100644 --- a/perllib/FixMyStreet/App/Controller/Location.pm +++ b/perllib/FixMyStreet/App/Controller/Location.pm @@ -112,7 +112,7 @@ sub determine_location_from_pc : Private { # Log failure in a log db try { my $dbfile = FixMyStreet->path_to('../data/analytics.sqlite'); - my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef) or die "$DBI::errstr\n"; + my $db = DBI->connect("dbi:SQLite:dbname=$dbfile", undef, undef, { PrintError => 0 }) or die "$DBI::errstr\n"; my $sth = $db->prepare("INSERT INTO location_searches_with_no_results (datetime, cobrand, geocoder, url, user_input) VALUES (?, ?, ?, ?, ?)") or die $db->errstr . "\n"; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index faa02f9fe..1a300da21 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -1247,7 +1247,7 @@ sub check_for_errors : Private { if ( $c->cobrand->allow_anonymous_reports ) { my $anon_details = $c->cobrand->anonymous_account; $report->user->email(undef) if $report->user->email eq $anon_details->{email}; - $report->name(undef) if $report->name eq $anon_details->{name}; + $report->name(undef) if $report->name && $report->name eq $anon_details->{name}; } return; diff --git a/perllib/FixMyStreet/Cobrand/UK.pm b/perllib/FixMyStreet/Cobrand/UK.pm index e44577bab..a9f8c2f01 100644 --- a/perllib/FixMyStreet/Cobrand/UK.pm +++ b/perllib/FixMyStreet/Cobrand/UK.pm @@ -93,15 +93,6 @@ sub geocode_postcode { return {}; } -sub remove_redundant_areas { - my $self = shift; - my $all_areas = shift; - - # Norwich is responsible for everything in its areas, not Norfolk - delete $all_areas->{2233} # - if $all_areas->{2391}; -} - sub short_name { my $self = shift; my ($area) = @_; diff --git a/perllib/FixMyStreet/Cobrand/UKCouncils.pm b/perllib/FixMyStreet/Cobrand/UKCouncils.pm index 6709ef565..64c22d543 100644 --- a/perllib/FixMyStreet/Cobrand/UKCouncils.pm +++ b/perllib/FixMyStreet/Cobrand/UKCouncils.pm @@ -130,7 +130,11 @@ sub users_restriction { push @$or_query, email => @domains; } - return $rs->search($or_query); + my $query = { + is_superuser => 0, + -or => $or_query + }; + return $rs->search($query); } sub base_url { diff --git a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm index 7e3522714..53b6859bf 100644 --- a/perllib/FixMyStreet/Map/UKCouncilWMTS.pm +++ b/perllib/FixMyStreet/Map/UKCouncilWMTS.pm @@ -45,6 +45,7 @@ sub reproject_from_latlon($$$) { # Reproject a BNG easting/northing into WGS84 lat/lon sub reproject_to_latlon($$$) { my ($self, $x, $y) = @_; + return (0,0) if $x<0 || $y<0; my ($lat, $lon) = Utils::convert_en_to_latlon($x, $y); return ($lat, $lon); } diff --git a/t/app/controller/admin/users.t b/t/app/controller/admin/users.t index a36a4187a..4f0298103 100644 --- a/t/app/controller/admin/users.t +++ b/t/app/controller/admin/users.t @@ -103,9 +103,12 @@ subtest 'search does not show user from another council' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => [ 'oxfordshire' ], }, sub { + $superuser->update({ from_body => $oxfordshire->id }); $mech->get_ok('/admin/users'); - $mech->get_ok('/admin/users?search=' . $user->name); + $mech->content_lacks('Super User'); + $superuser->update({ from_body => undef }); + $mech->get_ok('/admin/users?search=' . $user->name); $mech->content_contains( "Searching found no users." ); $mech->get_ok('/admin/users?search=' . $user->email); diff --git a/t/cobrand/cheshireeast.t b/t/cobrand/cheshireeast.t index c6c8198ab..4924a96ee 100644 --- a/t/cobrand/cheshireeast.t +++ b/t/cobrand/cheshireeast.t @@ -4,6 +4,9 @@ use FixMyStreet::TestMech; use FixMyStreet::Script::Alerts; use FixMyStreet::Script::Reports; +FixMyStreet::App->log->disable('info'); +END { FixMyStreet::App->log->enable('info'); } + my $mech = FixMyStreet::TestMech->new; my $body = $mech->create_body_ok( 21069, 'Cheshire East Council', { |