diff options
author | Matthew Somerville <matthew@mysociety.org> | 2016-04-20 15:40:15 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2016-04-20 19:36:25 +0100 |
commit | 0fe0f7e15317fd66925195bbb624bbb572d2b8ef (patch) | |
tree | 8b5197c482f2acf783dc37cbaded03e0a2f88e7c /perllib/FixMyStreet | |
parent | 193697bde57ef2cfd0a46bb5a85fa98727378297 (diff) |
Remove some unused cobrands.
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Around.pm | 4 | ||||
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Questionnaire.pm | 13 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 73 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 12 | ||||
-rwxr-xr-x | perllib/FixMyStreet/App/Controller/Rss.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Barnet.pm | 28 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/BellaVistaEnAccion.pm | 25 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 549 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/FixMyBarangay.pm | 55 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/ZeroTB.pm | 56 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 91 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Questionnaires.pm | 32 | ||||
-rw-r--r-- | perllib/FixMyStreet/Script/Reports.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/EmptyHomes.pm | 56 | ||||
-rw-r--r-- | perllib/FixMyStreet/SendReport/Open311.pm | 4 |
16 files changed, 79 insertions, 934 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin.pm b/perllib/FixMyStreet/App/Controller/Admin.pm index 2bf215c56..f54a862ab 100644 --- a/perllib/FixMyStreet/App/Controller/Admin.pm +++ b/perllib/FixMyStreet/App/Controller/Admin.pm @@ -345,8 +345,6 @@ sub update_contacts : Private { $errors{email} = _('Please enter a valid email') unless is_valid_email($email) || $email eq 'REFUSED'; $errors{note} = _('Please enter a message') unless $c->get_param('note'); - $category = 'Empty property' if $c->cobrand->moniker eq 'emptyhomes'; - my $contact = $c->model('DB::Contact')->find_or_new( { body_id => $c->stash->{body_id}, @@ -743,16 +741,6 @@ sub report_edit : Path('report_edit') : Args(1) { my $new_state = $c->get_param('state'); my $old_state = $problem->state; - if ( $new_state eq 'confirmed' - && $problem->state eq 'unconfirmed' - && $c->cobrand->moniker eq 'emptyhomes' ) - { - $c->stash->{status_message} = - '<p><em>' - . _('I am afraid you cannot confirm unconfirmed reports.') - . '</em></p>'; - $done = 1; - } my $flagged = $c->get_param('flagged') ? 1 : 0; my $non_public = $c->get_param('non_public') ? 1 : 0; diff --git a/perllib/FixMyStreet/App/Controller/Around.pm b/perllib/FixMyStreet/App/Controller/Around.pm index 1e6d9ec9e..b0340204a 100644 --- a/perllib/FixMyStreet/App/Controller/Around.pm +++ b/perllib/FixMyStreet/App/Controller/Around.pm @@ -47,7 +47,7 @@ sub index : Path : Args(0) { } # Check to see if the spot is covered by a area - if not show an error. - return unless $c->cobrand->moniker eq 'fixmybarangay' || $c->forward('check_location_is_acceptable'); + return unless $c->forward('check_location_is_acceptable'); # If we have a partial - redirect to /report/new so that it can be # completed. @@ -182,7 +182,7 @@ sub display_location : Private { # create a list of all the pins my @pins; - unless ($c->get_param('no_pins') || $c->cobrand->moniker eq 'emptyhomes') { + unless ($c->get_param('no_pins')) { @pins = map { # Here we might have a DB::Problem or a DB::Nearby, we always want the problem. my $p = (ref $_ eq 'FixMyStreet::App::Model::DB::Nearby') ? $_->problem : $_; diff --git a/perllib/FixMyStreet/App/Controller/Questionnaire.pm b/perllib/FixMyStreet/App/Controller/Questionnaire.pm index 8fe2514c0..017a552db 100755 --- a/perllib/FixMyStreet/App/Controller/Questionnaire.pm +++ b/perllib/FixMyStreet/App/Controller/Questionnaire.pm @@ -47,14 +47,6 @@ sub check_questionnaire : Private { $c->stash->{problem} = $problem; $c->stash->{answered_ever_reported} = $problem->user->answered_ever_reported; - - # EHA needs to know how many to alter display, and whether to send another or not - if ($c->cobrand->moniker eq 'emptyhomes') { - $c->stash->{num_questionnaire} = $c->model('DB::Questionnaire')->count( - { problem_id => $problem->id } - ); - } - } =head2 submit @@ -236,11 +228,6 @@ sub process_questionnaire : Private { $c->stash->{update} = Utils::cleanup_text($c->stash->{update}, { allow_multiline => 1 }); - # EHA questionnaires done for you - if ($c->cobrand->moniker eq 'emptyhomes') { - $c->stash->{another} = $c->stash->{num_questionnaire}==1 ? 'Yes' : 'No'; - } - my @errors; push @errors, _('Please state whether or not the problem has been fixed') unless $c->stash->{been_fixed}; diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index f9762662c..7126e962e 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -619,57 +619,35 @@ sub setup_categories_and_bodies : Private { $c->stash->{unresponsive}{ALL} = $first_body->id; } - # FIXME - implement in cobrand - if ( $c->cobrand->moniker eq 'emptyhomes' ) { + # keysort does not appear to obey locale so use strcoll (see i18n.t) + @contacts = sort { strcoll( $a->category, $b->category ) } @contacts; - # add all bodies found to the list - foreach (@contacts) { - $bodies_to_list{ $_->body_id } = 1; - } - - # set our own categories - @category_options = ( - _('-- Pick a property type --'), - _('Empty house or bungalow'), - _('Empty flat or maisonette'), - _('Whole block of empty flats'), - _('Empty office or other commercial'), - _('Empty pub or bar'), - _('Empty public building - school, hospital, etc.') - ); - - } else { - - # keysort does not appear to obey locale so use strcoll (see i18n.t) - @contacts = sort { strcoll( $a->category, $b->category ) } @contacts; + my %seen; + foreach my $contact (@contacts) { - my %seen; - foreach my $contact (@contacts) { + $bodies_to_list{ $contact->body_id } = 1; - $bodies_to_list{ $contact->body_id } = 1; + unless ( $seen{$contact->category} ) { + push @category_options, $contact->category; - unless ( $seen{$contact->category} ) { - push @category_options, $contact->category; + my $metas = $contact->get_extra_fields; + $category_extras{ $contact->category } = $metas + if scalar @$metas; - my $metas = $contact->get_extra_fields; - $category_extras{ $contact->category } = $metas - if scalar @$metas; + my $body_send_method = $bodies{$contact->body_id}->send_method || ''; + $c->stash->{unresponsive}{$contact->category} = $contact->body_id + if !$c->stash->{unresponsive}{ALL} && + ($contact->email =~ /^REFUSED$/i || $body_send_method eq 'Refused'); - my $body_send_method = $bodies{$contact->body_id}->send_method || ''; - $c->stash->{unresponsive}{$contact->category} = $contact->body_id - if !$c->stash->{unresponsive}{ALL} && - ($contact->email =~ /^REFUSED$/i || $body_send_method eq 'Refused'); - - $non_public_categories{ $contact->category } = 1 if $contact->non_public; - } - $seen{$contact->category} = 1; + $non_public_categories{ $contact->category } = 1 if $contact->non_public; } + $seen{$contact->category} = 1; + } - if (@category_options) { - # If there's an Other category present, put it at the bottom - @category_options = ( _('-- Pick a category --'), grep { $_ ne _('Other') } @category_options ); - push @category_options, _('Other') if $seen{_('Other')}; - } + if (@category_options) { + # If there's an Other category present, put it at the bottom + @category_options = ( _('-- Pick a category --'), grep { $_ ne _('Other') } @category_options ); + push @category_options, _('Other') if $seen{_('Other')}; } $c->cobrand->munge_category_list(\@category_options, \@contacts, \%category_extras) @@ -851,12 +829,7 @@ sub process_report : Private { my $first_area = ( values %$areas )[0]; my $first_body = ( values %$bodies )[0]; - if ( $c->cobrand->moniker eq 'emptyhomes' ) { - - $bodies = join( ',', @{ $c->stash->{bodies_to_list} } ) || -1; - $report->bodies_str( $bodies ); - - } elsif ( $report->category ) { + if ( $report->category ) { # FIXME All contacts were fetched in setup_categories_and_bodies, # so can this DB call also be avoided? @@ -1063,7 +1036,7 @@ sub save_user_and_report : Private { $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->get_param('external_source_id') =~ /^\d+$/) { + if (($c->get_param('external_source_id') || "") =~ /^\d+$/) { $c->stash->{external_source_id} = $c->get_param('external_source_id'); $report->external_source_id( $c->get_param('external_source_id') ); $report->external_source( $c->config->{MESSAGE_MANAGER_URL} ) ; diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index 02dc4dc11..5bcbb3dc4 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -141,15 +141,9 @@ sub ward : Path : Args(2) { area => $c->stash->{ward} ? $c->stash->{ward}->{id} : [ keys %{$c->stash->{body}->areas} ], any_zoom => 1, ); - if ( $c->cobrand->moniker eq 'emptyhomes' ) { - FixMyStreet::Map::display_map( - $c, %map_params, latitude => 0, longitude => 0, - ); - } else { - FixMyStreet::Map::display_map( - $c, %map_params, pins => $pins, - ); - } + FixMyStreet::Map::display_map( + $c, %map_params, pins => $pins, + ); $c->cobrand->tweak_all_reports_map( $c ); diff --git a/perllib/FixMyStreet/App/Controller/Rss.pm b/perllib/FixMyStreet/App/Controller/Rss.pm index d708aa71c..8d4f8313c 100755 --- a/perllib/FixMyStreet/App/Controller/Rss.pm +++ b/perllib/FixMyStreet/App/Controller/Rss.pm @@ -162,7 +162,6 @@ sub local_problems_ll : Private { sub output : Private { my ( $self, $c ) = @_; - $c->detach( '/page_error_404_not_found', [ 'Feed not found' ] ) if $c->cobrand->moniker eq 'emptyhomes'; $c->forward( 'lookup_type' ); $c->forward( 'query_main' ); $c->forward( 'generate' ); diff --git a/perllib/FixMyStreet/Cobrand/Barnet.pm b/perllib/FixMyStreet/Cobrand/Barnet.pm deleted file mode 100644 index df8757009..000000000 --- a/perllib/FixMyStreet/Cobrand/Barnet.pm +++ /dev/null @@ -1,28 +0,0 @@ -package FixMyStreet::Cobrand::Barnet; -use parent 'FixMyStreet::Cobrand::UKCouncils'; - -use strict; -use warnings; - -sub council_id { return 2489; } -sub council_area { return 'Barnet'; } -sub council_name { return 'Barnet Council'; } -sub council_url { return 'barnet'; } - -sub disambiguate_location { - my $self = shift; - return { - %{ $self->SUPER::disambiguate_location() }, - town => 'Barnet', - centre => '51.612832,-0.218169', - span => '0.0563,0.09', - bounds => [ 51.584682, -0.263169, 51.640982, -0.173169 ], - }; -} - -sub example_places { - return [ 'N11 1NP', 'Wood St' ]; -} - -1; - diff --git a/perllib/FixMyStreet/Cobrand/BellaVistaEnAccion.pm b/perllib/FixMyStreet/Cobrand/BellaVistaEnAccion.pm deleted file mode 100644 index 58bc6973d..000000000 --- a/perllib/FixMyStreet/Cobrand/BellaVistaEnAccion.pm +++ /dev/null @@ -1,25 +0,0 @@ -package FixMyStreet::Cobrand::BellaVistaEnAccion; -use base 'FixMyStreet::Cobrand::Default'; - -use strict; -use warnings; - -sub country { - return 'CL'; -} - -sub example_places { - return ( 'Dominica, Recoleta', 'Pio Nono' ); -} - -sub languages { [ 'es-cl,Castellano,es_CL' ] } - -sub disambiguate_location { - return { - country => 'cl', - town => 'Santiago', - }; -} - -1; - diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm deleted file mode 100644 index 70c3c9469..000000000 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ /dev/null @@ -1,549 +0,0 @@ -package FixMyStreet::Cobrand::EmptyHomes; -use base 'FixMyStreet::Cobrand::UK'; - -use strict; -use warnings; - -use FixMyStreet; -use mySociety::Locale; -use Carp; - -sub path_to_web_templates { - my $self = shift; - return [ FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify ]; -} - -sub _fallback_body_sender { - my ( $self, $body, $category ) = @_; - - return { method => 'EmptyHomes' }; -}; - -=item - -Return the base url for this cobranded site - -=cut - -sub base_url { - my $base_url = FixMyStreet->config('BASE_URL'); - if ( $base_url !~ /emptyhomes/ ) { - $base_url =~ s/http:\/\//http:\/\/emptyhomes\./g; - } - return $base_url; -} - -sub area_types { - [ 'DIS', 'LBO', 'MTD', 'UTA', 'LGD', 'COI' ]; # No CTY -} - -sub base_url_with_lang { - my $self = shift; - - my $base = $self->base_url; - - my $lang = $mySociety::Locale::lang; - if ($lang eq 'cy') { - $base =~ s{http://}{$&cy.}; - } else { - $base =~ s{http://}{$&en.}; - } - return $base; -} - -sub languages { [ 'en-gb,English,en_GB', 'cy,Cymraeg,cy_GB' ] } -sub language_domain { 'FixMyStreet-EmptyHomes' } - -=item shorten_recency_if_new_greater_than_fixed - -For empty homes we don't want to shorten the recency - -=cut - -sub shorten_recency_if_new_greater_than_fixed { - return 0; -} - -=head2 default_photo_resize - -Size that photos are to be resized to for display. If photos aren't -to be resized then return 0; - -=cut - -sub default_photo_resize { return '195x'; } - -sub short_name { - my $self = shift; - my ($area) = @_; - - my $name = $area->{name} || $area->name; - $name =~ s/ (Borough|City|District|County) Council$//; - $name =~ s/ Council$//; - $name =~ s/ & / and /; - $name =~ tr{/}{_}; - $name = URI::Escape::uri_escape_utf8($name); - $name =~ s/%20/-/g; - return $name; -} - -=item council_rss_alert_options - -Generate a set of options for council rss alerts. - -=cut - -sub council_rss_alert_options { - my $self = shift; - my $all_councils = shift; - my $c = shift; - - my %councils = map { $_ => 1 } @{$self->area_types}; - - my $num_councils = scalar keys %$all_councils; - - my ( @options, @reported_to_options ); - my ($council, $ward); - foreach (values %$all_councils) { - $_->{short_name} = $self->short_name( $_ ); - ( $_->{id_name} = $_->{short_name} ) =~ tr/+/_/; - if ($councils{$_->{type}}) { - $council = $_; - } else { - $ward = $_; - } - } - - push @options, { - type => 'council', - id => sprintf( 'council:%s:%s', $council->{id}, $council->{id_name} ), - text => sprintf( _('Problems within %s'), $council->{name}), - rss_text => sprintf( _('RSS feed of problems within %s'), $council->{name}), - uri => $c->uri_for( '/rss/reports/' . $council->{short_name} ), - }; - push @options, { - type => 'ward', - id => sprintf( 'ward:%s:%s:%s:%s', $council->{id}, $ward->{id}, $council->{id_name}, $ward->{id_name} ), - rss_text => sprintf( _('RSS feed of problems within %s ward'), $ward->{name}), - text => sprintf( _('Problems within %s ward'), $ward->{name}), - uri => $c->uri_for( '/rss/reports/' . $council->{short_name} . '/' . $ward->{short_name} ), - }; - - return ( \@options, @reported_to_options ? \@reported_to_options : undef ); -} - -sub report_form_extras { - ( { name => 'address', required => 1 } ) -} - -sub front_stats_data { - my ( $self ) = @_; - my $key = "recent_new"; - my $result = Memcached::get($key); - unless ($result) { - $result = $self->problems->search( - { state => [ FixMyStreet::DB::Result::Problem->visible_states() ] } - )->count; - foreach my $v (values %{$self->old_site_stats}) { - $result += $v; - } - Memcached::set($key, $result, 3600); - } - return $result; -} - -# A record of the number of reports from the Channel 4 site and other old data -sub old_site_stats { - return { - 2223 => 95, - 2238 => 82, - 2245 => 54, - 2248 => 31, - 2250 => 132, - 2253 => 15, - 2255 => 25, - 2256 => 8, - 2257 => 3, - 2258 => 14, - 2259 => 5, - 2260 => 22, - 2261 => 12, - 2262 => 21, - 2263 => 14, - 2264 => 1, - 2267 => 1, - 2271 => 13, - 2272 => 7, - 2273 => 13, - 2274 => 7, - 2275 => 15, - 2276 => 14, - 2277 => 10, - 2278 => 7, - 2279 => 23, - 2280 => 16, - 2281 => 25, - 2282 => 14, - 2283 => 10, - 2284 => 22, - 2285 => 25, - 2286 => 32, - 2287 => 13, - 2288 => 13, - 2289 => 16, - 2290 => 18, - 2291 => 1, - 2292 => 9, - 2293 => 15, - 2294 => 16, - 2295 => 12, - 2296 => 4, - 2299 => 2, - 2300 => 1, - 2304 => 10, - 2305 => 17, - 2306 => 6, - 2307 => 11, - 2308 => 17, - 2309 => 9, - 2310 => 6, - 2311 => 9, - 2312 => 26, - 2313 => 2, - 2314 => 34, - 2315 => 18, - 2316 => 13, - 2317 => 17, - 2318 => 7, - 2319 => 14, - 2320 => 4, - 2321 => 20, - 2322 => 7, - 2323 => 10, - 2324 => 7, - 2325 => 15, - 2326 => 12, - 2327 => 25, - 2328 => 23, - 2329 => 11, - 2330 => 4, - 2331 => 29, - 2332 => 12, - 2333 => 7, - 2334 => 5, - 2335 => 16, - 2336 => 7, - 2337 => 7, - 2338 => 2, - 2339 => 12, - 2340 => 2, - 2341 => 7, - 2342 => 14, - 2343 => 20, - 2344 => 13, - 2345 => 17, - 2346 => 6, - 2347 => 4, - 2348 => 6, - 2349 => 18, - 2350 => 13, - 2351 => 11, - 2352 => 24, - 2353 => 10, - 2354 => 20, - 2355 => 14, - 2356 => 13, - 2357 => 14, - 2358 => 8, - 2359 => 6, - 2360 => 10, - 2361 => 36, - 2362 => 17, - 2363 => 8, - 2364 => 7, - 2365 => 8, - 2366 => 26, - 2367 => 19, - 2368 => 20, - 2369 => 8, - 2370 => 14, - 2371 => 79, - 2372 => 10, - 2373 => 5, - 2374 => 4, - 2375 => 12, - 2376 => 10, - 2377 => 24, - 2378 => 9, - 2379 => 8, - 2380 => 25, - 2381 => 13, - 2382 => 11, - 2383 => 16, - 2384 => 18, - 2385 => 12, - 2386 => 18, - 2387 => 5, - 2388 => 8, - 2389 => 12, - 2390 => 11, - 2391 => 23, - 2392 => 11, - 2393 => 16, - 2394 => 9, - 2395 => 27, - 2396 => 8, - 2397 => 27, - 2398 => 14, - 2402 => 1, - 2403 => 18, - 2404 => 14, - 2405 => 7, - 2406 => 9, - 2407 => 12, - 2408 => 3, - 2409 => 8, - 2410 => 23, - 2411 => 27, - 2412 => 9, - 2413 => 20, - 2414 => 96, - 2415 => 11, - 2416 => 20, - 2417 => 18, - 2418 => 24, - 2419 => 18, - 2420 => 7, - 2421 => 29, - 2427 => 7, - 2428 => 15, - 2429 => 18, - 2430 => 32, - 2431 => 9, - 2432 => 17, - 2433 => 8, - 2434 => 10, - 2435 => 14, - 2436 => 13, - 2437 => 11, - 2438 => 5, - 2439 => 4, - 2440 => 23, - 2441 => 8, - 2442 => 18, - 2443 => 12, - 2444 => 3, - 2445 => 8, - 2446 => 31, - 2447 => 15, - 2448 => 3, - 2449 => 12, - 2450 => 11, - 2451 => 8, - 2452 => 20, - 2453 => 25, - 2454 => 8, - 2455 => 6, - 2456 => 24, - 2457 => 6, - 2458 => 10, - 2459 => 15, - 2460 => 17, - 2461 => 20, - 2462 => 12, - 2463 => 16, - 2464 => 5, - 2465 => 14, - 2466 => 20, - 2467 => 14, - 2468 => 12, - 2469 => 4, - 2470 => 1, - 2471 => 1, - 2474 => 9, - 2475 => 12, - 2476 => 11, - 2477 => 9, - 2478 => 10, - 2479 => 21, - 2480 => 26, - 2481 => 30, - 2482 => 38, - 2483 => 46, - 2484 => 63, - 2485 => 7, - 2486 => 14, - 2487 => 16, - 2488 => 14, - 2489 => 39, - 2490 => 112, - 2491 => 79, - 2492 => 137, - 2493 => 55, - 2494 => 18, - 2495 => 41, - 2496 => 41, - 2497 => 22, - 2498 => 26, - 2499 => 46, - 2500 => 62, - 2501 => 90, - 2502 => 47, - 2503 => 32, - 2504 => 33, - 2505 => 47, - 2506 => 56, - 2507 => 26, - 2508 => 48, - 2509 => 47, - 2510 => 16, - 2511 => 6, - 2512 => 4, - 2513 => 41, - 2514 => 138, - 2515 => 48, - 2516 => 65, - 2517 => 35, - 2518 => 40, - 2519 => 31, - 2520 => 27, - 2521 => 25, - 2522 => 34, - 2523 => 27, - 2524 => 47, - 2525 => 22, - 2526 => 125, - 2527 => 126, - 2528 => 93, - 2529 => 23, - 2530 => 28, - 2531 => 24, - 2532 => 46, - 2533 => 22, - 2534 => 24, - 2535 => 27, - 2536 => 44, - 2537 => 54, - 2538 => 17, - 2539 => 13, - 2540 => 29, - 2541 => 15, - 2542 => 19, - 2543 => 14, - 2544 => 34, - 2545 => 30, - 2546 => 38, - 2547 => 32, - 2548 => 22, - 2549 => 37, - 2550 => 9, - 2551 => 41, - 2552 => 17, - 2553 => 36, - 2554 => 10, - 2555 => 20, - 2556 => 13, - 2557 => 19, - 2558 => 13, - 2559 => 23, - 2560 => 13, - 2561 => 62, - 2562 => 29, - 2563 => 31, - 2564 => 34, - 2565 => 57, - 2566 => 16, - 2567 => 22, - 2568 => 40, - 2569 => 5, - 2570 => 38, - 2571 => 17, - 2572 => 9, - 2573 => 12, - 2574 => 10, - 2575 => 16, - 2576 => 2, - 2577 => 28, - 2578 => 37, - 2579 => 79, - 2580 => 17, - 2581 => 734, - 2582 => 11, - 2583 => 23, - 2584 => 16, - 2585 => 4, - 2586 => 33, - 2587 => 3, - 2588 => 22, - 2589 => 19, - 2590 => 14, - 2591 => 9, - 2592 => 19, - 2593 => 11, - 2594 => 14, - 2595 => 13, - 2596 => 21, - 2597 => 10, - 2598 => 16, - 2599 => 26, - 2600 => 1, - 2601 => 19, - 2602 => 23, - 2603 => 12, - 2604 => 31, - 2605 => 30, - 2606 => 5, - 2607 => 32, - 2608 => 14, - 2609 => 27, - 2610 => 15, - 2611 => 20, - 2612 => 22, - 2613 => 20, - 2614 => 97, - 2615 => 29, - 2616 => 6, - 2617 => 34, - 2618 => 16, - 2619 => 25, - 2620 => 12, - 2621 => 29, - 2622 => 18, - 2623 => 12, - 2624 => 58, - 2625 => 54, - 2626 => 15, - 2627 => 1, - 2629 => 17, - 2630 => 22, - 2636 => 13, - 2637 => 13, - 2638 => 25, - 2639 => 57, - 2640 => 15, - 2641 => 11, - 2642 => 14, - 2643 => 38, - 2644 => 19, - 2645 => 6, - 2646 => 1, - 2647 => 16, - 2648 => 25, - 2649 => 38, - 2650 => 12, - 2651 => 78, - 2652 => 12, - 2654 => 16, - 2655 => 13, - 2656 => 15, - 2657 => 44, - 2658 => 53, - 16869 => 73, - 21068 => 44, - 21069 => 57, - 21070 => 20, - }; -} - -1; - diff --git a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm b/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm deleted file mode 100644 index 194556e72..000000000 --- a/perllib/FixMyStreet/Cobrand/FixMyBarangay.pm +++ /dev/null @@ -1,55 +0,0 @@ -package FixMyStreet::Cobrand::FixMyBarangay; -use base 'FixMyStreet::Cobrand::Default'; - -use strict; -use warnings; - -sub country { - return 'PH'; -} - -sub language_domain { 'FixMyBarangay' } - -sub area_types { - return [ 'BGY' ]; -} - -sub disambiguate_location { - return { - country => 'ph', - bing_country => 'Philippines', - }; -} - -sub only_authed_can_create { - return 1; -} - -# effectively allows barangay staff to hide reports -sub council_id { return '1,2' ; } - -sub areas_on_around { - return [ 1, 2 ]; -} - -sub can_support_problems { - return 1; -} - -sub default_show_name { - my $self = shift; - - return 0 if $self->{c}->user->from_council; - return 1; -} - -# makes no sense to send questionnaires since FMB's reporters are mostly staff -sub send_questionnaires { - return 0; -} - -# let staff hide reports in their own barangay -sub users_can_hide { 1 } - -1; - diff --git a/perllib/FixMyStreet/Cobrand/ZeroTB.pm b/perllib/FixMyStreet/Cobrand/ZeroTB.pm deleted file mode 100644 index ef1b0b1e1..000000000 --- a/perllib/FixMyStreet/Cobrand/ZeroTB.pm +++ /dev/null @@ -1,56 +0,0 @@ -package FixMyStreet::Cobrand::ZeroTB; -use base 'FixMyStreet::Cobrand::Default'; - -use strict; -use warnings; - -sub enter_postcode_text { return _ ('Enter a nearby street name and area, postal code or district in Delhi'); } - -sub country { - return 'IN'; -} - -sub disambiguate_location { - return { - country => 'in', - town => 'Delhi', - bounds => [ 28.404625000000024, 76.838845800000072, 28.884380600000028, 77.347877500000067 ], - }; -} - -sub only_authed_can_create { return 1; } -sub allow_photo_display { return 0; } -sub allow_photo_upload{ return 0; } -sub send_questionnaires { return 0; } -sub on_map_default_max_pin_age { return 0; } -sub never_confirm_updates { 1; } -sub include_time_in_update_alerts { 1; } - -sub pin_colour { - return 'clinic'; -} - -sub path_to_pin_icons { - return '/cobrands/zerotb/images/'; -} - -sub get_clinic_list { - my $self = shift; - - return $self->problems->search({ state => 'confirmed' }, { order_by => 'title' }); -} - -sub prettify_dt { - my ( $self, $dt, $type ) = @_; - $type ||= ''; - - if ( $type eq 'alert' ) { - return $dt->strftime('%H:%M %Y-%m-%d'); - } else { - return Utils::prettify_dt( $dt, $type ); - } - -} - -1; - diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 764f381a2..12dad073e 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -557,59 +557,48 @@ sub meta_line { my $date_time = Utils::prettify_dt( $problem->confirmed ); my $meta = ''; - # FIXME Should be in cobrand - if ($c->cobrand->moniker eq 'emptyhomes') { - - my $category = _($problem->category); - utf8::decode($category); - $meta = sprintf(_('%s, reported at %s'), $category, $date_time); - - } else { - - if ( $problem->anonymous ) { - if ( $problem->service - and $problem->category && $problem->category ne _('Other') ) - { - $meta = - sprintf( _('Reported via %s in the %s category anonymously at %s'), - $problem->service, $problem->category, $date_time ); - } - elsif ( $problem->service ) { - $meta = sprintf( _('Reported via %s anonymously at %s'), - $problem->service, $date_time ); - } - elsif ( $problem->category and $problem->category ne _('Other') ) { - $meta = sprintf( _('Reported in the %s category anonymously at %s'), - $problem->category, $date_time ); - } - else { - $meta = sprintf( _('Reported anonymously at %s'), $date_time ); - } + if ( $problem->anonymous ) { + if ( $problem->service + and $problem->category && $problem->category ne _('Other') ) + { + $meta = + sprintf( _('Reported via %s in the %s category anonymously at %s'), + $problem->service, $problem->category, $date_time ); + } + elsif ( $problem->service ) { + $meta = sprintf( _('Reported via %s anonymously at %s'), + $problem->service, $date_time ); + } + elsif ( $problem->category and $problem->category ne _('Other') ) { + $meta = sprintf( _('Reported in the %s category anonymously at %s'), + $problem->category, $date_time ); } else { - if ( $problem->service - and $problem->category && $problem->category ne _('Other') ) - { - $meta = sprintf( - _('Reported via %s in the %s category by %s at %s'), - $problem->service, $problem->category, - $problem->name, $date_time - ); - } - elsif ( $problem->service ) { - $meta = sprintf( _('Reported via %s by %s at %s'), - $problem->service, $problem->name, $date_time ); - } - elsif ( $problem->category and $problem->category ne _('Other') ) { - $meta = sprintf( _('Reported in the %s category by %s at %s'), - $problem->category, $problem->name, $date_time ); - } - else { - $meta = - sprintf( _('Reported by %s at %s'), $problem->name, $date_time ); - } + $meta = sprintf( _('Reported anonymously at %s'), $date_time ); + } + } + else { + if ( $problem->service + and $problem->category && $problem->category ne _('Other') ) + { + $meta = sprintf( + _('Reported via %s in the %s category by %s at %s'), + $problem->service, $problem->category, + $problem->name, $date_time + ); + } + elsif ( $problem->service ) { + $meta = sprintf( _('Reported via %s by %s at %s'), + $problem->service, $problem->name, $date_time ); + } + elsif ( $problem->category and $problem->category ne _('Other') ) { + $meta = sprintf( _('Reported in the %s category by %s at %s'), + $problem->category, $problem->name, $date_time ); + } + else { + $meta = + sprintf( _('Reported by %s at %s'), $problem->name, $date_time ); } - } return $meta; @@ -660,7 +649,7 @@ sub response_templates { } # returns true if the external id is the council's ref, i.e., useful to publish it -# (by way of an example, the barnet send method returns a useful reference when +# (by way of an example, the Oxfordshire send method returns a useful reference when # it succeeds, so that is the ref we should show on the problem report page). # Future: this is installation-dependent so maybe should be using the contact # data to determine if the external id is public on a council-by-council basis. diff --git a/perllib/FixMyStreet/Script/Questionnaires.pm b/perllib/FixMyStreet/Script/Questionnaires.pm index 2d676f15d..f72f59077 100644 --- a/perllib/FixMyStreet/Script/Questionnaires.pm +++ b/perllib/FixMyStreet/Script/Questionnaires.pm @@ -10,8 +10,6 @@ use FixMyStreet::Cobrand; sub send { my ( $params ) = @_; send_questionnaires_period( '4 weeks', $params ); - send_questionnaires_period( '26 weeks', $params ) - if $params->{site} eq 'emptyhomes'; } sub send_questionnaires_period { @@ -29,17 +27,11 @@ sub send_questionnaires_period { ], send_questionnaire => 1, }; - # FIXME Do these a bit better... - if ($params->{site} eq 'emptyhomes' && $period eq '4 weeks') { - $q_params->{'(select max(whensent) from questionnaire where me.id=problem_id)'} = undef; - } elsif ($params->{site} eq 'emptyhomes' && $period eq '26 weeks') { - $q_params->{'(select max(whensent) from questionnaire where me.id=problem_id)'} = { '!=', undef }; - } else { - $q_params->{'-or'} = [ - '(select max(whensent) from questionnaire where me.id=problem_id)' => undef, - '(select max(whenanswered) from questionnaire where me.id=problem_id)' => { '<', \"current_timestamp - '$period'::interval" } - ]; - } + + $q_params->{'-or'} = [ + '(select max(whensent) from questionnaire where me.id=problem_id)' => undef, + '(select max(whenanswered) from questionnaire where me.id=problem_id)' => { '<', \"current_timestamp - '$period'::interval" } + ]; my $unsent = FixMyStreet::DB->resultset('Problem')->search( $q_params, { order_by => { -desc => 'confirmed' } @@ -60,13 +52,7 @@ sub send_questionnaires_period { # call checks if this is the host that sends mail for this cobrand. next unless $cobrand->email_host; - my $template; - if ($params->{site} eq 'emptyhomes') { - ($template = $period) =~ s/ //; - $template = Utils::read_file( FixMyStreet->path_to( "templates/email/emptyhomes/" . $row->lang . "/questionnaire-$template.txt" )->stringify ); - } else { - $template = FixMyStreet->get_email_template($cobrand->moniker, $row->lang, 'questionnaire.txt'); - } + my $template = FixMyStreet->get_email_template($cobrand->moniker, $row->lang, 'questionnaire.txt'); my %h = map { $_ => $row->$_ } qw/name title detail category/; $h{created} = Utils::prettify_duration( time() - $row->confirmed->epoch, 'week' ); @@ -76,10 +62,8 @@ sub send_questionnaires_period { whensent => \'current_timestamp', } ); - # We won't send another questionnaire unless they ask for it (or it was - # the first EHA questionnaire. - $row->send_questionnaire( 0 ) - if $params->{site} ne 'emptyhomes' || $period eq '26 weeks'; + # We won't send another questionnaire unless they ask for it + $row->send_questionnaire( 0 ); my $token = FixMyStreet::DB->resultset("Token")->new_result( { scope => 'questionnaire', diff --git a/perllib/FixMyStreet/Script/Reports.pm b/perllib/FixMyStreet/Script/Reports.pm index 8b1ce6759..75111b852 100644 --- a/perllib/FixMyStreet/Script/Reports.pm +++ b/perllib/FixMyStreet/Script/Reports.pm @@ -203,7 +203,7 @@ sub send(;$) { if (FixMyStreet->config('STAGING_SITE') && !FixMyStreet->config('SEND_REPORTS_ON_STAGING')) { # on a staging server send emails to ourselves rather than the bodies - %reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::(Email|EmptyHomes)/ } keys %reporters; + %reporters = map { $_ => $reporters{$_} } grep { /FixMyStreet::SendReport::Email/ } keys %reporters; unless (%reporters) { %reporters = ( 'FixMyStreet::SendReport::Email' => FixMyStreet::SendReport::Email->new() ); } diff --git a/perllib/FixMyStreet/SendReport/EmptyHomes.pm b/perllib/FixMyStreet/SendReport/EmptyHomes.pm deleted file mode 100644 index b5faf8ddc..000000000 --- a/perllib/FixMyStreet/SendReport/EmptyHomes.pm +++ /dev/null @@ -1,56 +0,0 @@ -package FixMyStreet::SendReport::EmptyHomes; - -use Moo; -use namespace::autoclean; - -use mySociety::MaPit; - -BEGIN { extends 'FixMyStreet::SendReport::Email'; } - -sub build_recipient_list { - my ( $self, $row, $h ) = @_; - - my $all_confirmed = 1; - foreach my $body ( @{ $self->bodies } ) { - my $contact = $row->result_source->schema->resultset("Contact")->find( { - deleted => 0, - body_id => $body->id, - category => 'Empty property', - } ); - - my ($body_email, $confirmed, $note) = ( $contact->email, $contact->confirmed, $contact->note ); - - unless ($confirmed) { - $all_confirmed = 0; - #$note = 'Council ' . $row->body . ' deleted' - #unless $note; - $body_email = 'N/A' unless $body_email; - #$notgot{$body_email}{$row->category}++; - #$note{$body_email}{$row->category} = $note; - } - - push @{ $self->to }, [ $body_email, $body->name ]; - - my $area_info = mySociety::MaPit::call('area', $body->body_areas->first->area_id); - my $country = $area_info->{country}; - if ($country eq 'W') { - push @{$self->bcc}, 'wales@' . FixMyStreet->config('EMAIL_DOMAIN'); - } elsif ($country eq 'S') { - push @{$self->bcc}, 'scotland@' . FixMyStreet->config('EMAIL_DOMAIN'); - } else { - push @{$self->bcc}, 'eha@' . FixMyStreet->config('EMAIL_DOMAIN'); - } - } - - # Set address email parameter from added data - $h->{address} = $row->extra->{address}; - - return $all_confirmed && @{$self->to}; -} - -sub get_template { - my ( $self, $row ) = @_; - return Utils::read_file( FixMyStreet->path_to( "templates", "email", "emptyhomes", $row->lang, "submit.txt" )->stringify ); -} - -1; diff --git a/perllib/FixMyStreet/SendReport/Open311.pm b/perllib/FixMyStreet/SendReport/Open311.pm index 4844aa2e9..5c7fa30f3 100644 --- a/perllib/FixMyStreet/SendReport/Open311.pm +++ b/perllib/FixMyStreet/SendReport/Open311.pm @@ -126,8 +126,8 @@ sub send { $revert = 1; } - if ($row->cobrand eq 'fixmybarangay' || $row->bodies_str =~ /$COUNCIL_ID_GREENWICH/) { - # FixMyBarangay endpoints expect external_id as an attribute, as do Greenwich + if ($row->bodies_str =~ /$COUNCIL_ID_GREENWICH/) { + # Greenwich endpoint expects external_id as an attribute $row->set_extra_fields( { 'name' => 'external_id', 'value' => $row->id } ); $revert = 1; } |