diff options
Diffstat (limited to 'perllib/FixMyStreet/App/Controller')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm | 81 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 6 |
3 files changed, 0 insertions, 103 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm deleted file mode 100644 index 0026acb9c..000000000 --- a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm +++ /dev/null @@ -1,81 +0,0 @@ -package FixMyStreet::App::Controller::Admin::ExorDefects; -use Moose; -use namespace::autoclean; - -use DateTime; -use Try::Tiny; -use FixMyStreet::Integrations::ExorRDI; -use FixMyStreet::DateRange; - -BEGIN { extends 'Catalyst::Controller'; } - - -sub index : Path : Args(0) { - my ( $self, $c ) = @_; - - foreach (qw(error_message start_date end_date user_id)) { - if ( defined $c->flash->{$_} ) { - $c->stash->{$_} = $c->flash->{$_}; - } - } - - my @inspectors = $c->cobrand->users->search({ - 'user_body_permissions.permission_type' => 'report_inspect' - }, { - join => 'user_body_permissions', - distinct => 1, - } - )->all; - $c->stash->{inspectors} = \@inspectors; - - # Default start/end date is today - my $now = DateTime->now( time_zone => - FixMyStreet->time_zone || FixMyStreet->local_time_zone ); - $c->stash->{start_date} ||= $now; - $c->stash->{end_date} ||= $now; - -} - -sub download : Path('download') : Args(0) { - my ( $self, $c ) = @_; - - if ( !$c->cobrand->can('exor_rdi_link_id') ) { - # This only works on the Oxfordshire cobrand currently. - $c->detach( '/page_error_404_not_found', [] ); - } - - my $range = FixMyStreet::DateRange->new( - start_date => $c->get_param('start_date'), - end_date => $c->get_param('end_date'), - parser => DateTime::Format::Strptime->new( pattern => '%Y-%m-%d' ), - ); - - my $params = { - start_date => $range->start, - inspection_date => $range->start, - end_date => $range->end, - user => $c->get_param('user_id'), - mark_as_processed => 0, - }; - my $rdi = FixMyStreet::Integrations::ExorRDI->new($params); - - try { - my $out = $rdi->construct; - $c->res->content_type('text/csv; charset=utf-8'); - $c->res->header('content-disposition' => "attachment; filename=" . $rdi->filename); - $c->res->body( $out ); - } catch { - die $_ unless $_ =~ /FixMyStreet::Integrations::ExorRDI::Error/; - if ($params->{user}) { - $c->flash->{error_message} = _("No inspections by that inspector in the selected date range."); - } else { - $c->flash->{error_message} = _("No inspections in the selected date range."); - } - $c->flash->{start_date} = $params->{start_date}; - $c->flash->{end_date} = $params->{end_date}; - $c->flash->{user_id} = $params->{user}; - $c->res->redirect( $c->uri_for( '' ) ); - }; -} - -1; diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index 662f865c3..692379de6 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -475,14 +475,6 @@ sub inspect : Private { }; $c->user->create_alert($problem->id, $options); } - - # If the state has been changed to action scheduled and they've said - # they want to raise a defect, consider the report to be inspected. - if ($problem->state eq 'action scheduled' && $c->get_param('raise_defect') && !$problem->get_extra_metadata('inspected')) { - $update_params{extra} = { 'defect_raised' => 1 }; - $problem->set_extra_metadata( inspected => 1 ); - $c->forward( '/admin/log_edit', [ $problem->id, 'problem', 'inspected' ] ); - } } $problem->non_public($c->get_param('non_public') ? 1 : 0); @@ -523,14 +515,6 @@ sub inspect : Private { } } - if ($permissions->{report_inspect}) { - if ( $c->get_param('defect_type') ) { - $problem->defect_type($problem->defect_types->find($c->get_param('defect_type'))); - } else { - $problem->defect_type(undef); - } - } - $c->cobrand->call_hook(report_inspect_update_extra => $problem); if ($valid) { diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index 5407ec937..03623259c 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -706,12 +706,6 @@ sub setup_categories_and_bodies : Private { # keysort does not appear to obey locale so use strcoll (see i18n.t) @contacts = sort { strcoll( $a->category, $b->category ) } @contacts; - # Get defect types for inspectors - if ($c->cobrand->can('council_area_id')) { - my $category_defect_types = FixMyStreet::App->model('DB::DefectType')->by_categories($c->cobrand->council_area_id, @contacts); - $c->stash->{category_defect_types} = $category_defect_types; - } - my %seen; foreach my $contact (@contacts) { |