diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Moderate.pm | 5 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report.pm | 16 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Reports.pm | 3 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Default.pm | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Oxfordshire.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Integrations/ExorRDI.pm | 21 |
6 files changed, 27 insertions, 21 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Moderate.pm b/perllib/FixMyStreet/App/Controller/Moderate.pm index 42dc759e5..4d3a97fa8 100644 --- a/perllib/FixMyStreet/App/Controller/Moderate.pm +++ b/perllib/FixMyStreet/App/Controller/Moderate.pm @@ -21,10 +21,7 @@ data to change. (Authentication requires: - user to be from_body - - user to have a "moderate" record in user_body_permissions (there is - currently no admin interface for this. Should be added, but - while we're trialing this, it's a simple case of adding a DB record - manually) + - user to have a "moderate" record in user_body_permissions The original data of the report is stored in moderation_original_data, so that it can be reverted/consulted if required. All moderation events are diff --git a/perllib/FixMyStreet/App/Controller/Report.pm b/perllib/FixMyStreet/App/Controller/Report.pm index c72c75d3a..138098d5f 100644 --- a/perllib/FixMyStreet/App/Controller/Report.pm +++ b/perllib/FixMyStreet/App/Controller/Report.pm @@ -377,15 +377,15 @@ sub inspect : Private { if ( $problem->state eq 'hidden' ) { $problem->get_photoset->delete_cached; } - if ( $problem->state eq 'duplicate' && $old_state ne 'duplicate' ) { - # If the report is being closed as duplicate, make sure the - # update records this. - $update_params{problem_state} = "duplicate"; - } - if ( $problem->state ne 'duplicate' ) { + if ( $problem->state eq 'duplicate') { + if (my $duplicate_of = $c->get_param('duplicate_of')) { + $problem->set_duplicate_of($duplicate_of); + } elsif (not $c->get_param('public_update')) { + $valid = 0; + push @{ $c->stash->{errors} }, _('Please provide a duplicate ID or public update for this report.'); + } + } else { $problem->unset_extra_metadata('duplicate_of'); - } elsif (my $duplicate_of = $c->get_param('duplicate_of')) { - $problem->set_duplicate_of($duplicate_of); } if ( $problem->state ne $old_state ) { diff --git a/perllib/FixMyStreet/App/Controller/Reports.pm b/perllib/FixMyStreet/App/Controller/Reports.pm index b0015acc5..b6281f0ca 100644 --- a/perllib/FixMyStreet/App/Controller/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Reports.pm @@ -575,16 +575,19 @@ sub stash_report_filter_status : Private { my $s = FixMyStreet::DB::Result::Problem->open_states(); %filter_problem_states = (%filter_problem_states, %$s); $filter_status{open} = 1; + $filter_status{$_} = 1 for keys %$s; } if ($status{closed}) { my $s = FixMyStreet::DB::Result::Problem->closed_states(); %filter_problem_states = (%filter_problem_states, %$s); $filter_status{closed} = 1; + $filter_status{$_} = 1 for keys %$s; } if ($status{fixed}) { my $s = FixMyStreet::DB::Result::Problem->fixed_states(); %filter_problem_states = (%filter_problem_states, %$s); $filter_status{fixed} = 1; + $filter_status{$_} = 1 for keys %$s; } if ($status{all}) { diff --git a/perllib/FixMyStreet/Cobrand/Default.pm b/perllib/FixMyStreet/Cobrand/Default.pm index b482d7612..9e49099aa 100644 --- a/perllib/FixMyStreet/Cobrand/Default.pm +++ b/perllib/FixMyStreet/Cobrand/Default.pm @@ -1084,7 +1084,6 @@ sub state_groups_inspect { [ $rs->display('confirmed'), [ grep { $_ ne 'planned' } FixMyStreet::DB::Result::Problem->open_states ] ], @fixed ? [ $rs->display('fixed'), [ 'fixed - council' ] ] : (), [ $rs->display('closed'), [ grep { $_ ne 'closed' } FixMyStreet::DB::Result::Problem->closed_states ] ], - [ $rs->display('hidden'), [ 'hidden' ] ] ] } diff --git a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm index cdd186fef..23324e763 100644 --- a/perllib/FixMyStreet/Cobrand/Oxfordshire.pm +++ b/perllib/FixMyStreet/Cobrand/Oxfordshire.pm @@ -217,7 +217,7 @@ sub user_extra_fields { sub display_days_ago_threshold { 28 } -sub max_detailed_info_length { 172 } +sub max_detailed_info_length { 164 } sub defect_type_extra_fields { return [ diff --git a/perllib/FixMyStreet/Integrations/ExorRDI.pm b/perllib/FixMyStreet/Integrations/ExorRDI.pm index 093688e47..dc865e1ad 100644 --- a/perllib/FixMyStreet/Integrations/ExorRDI.pm +++ b/perllib/FixMyStreet/Integrations/ExorRDI.pm @@ -46,6 +46,9 @@ sub construct { time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone ); + my $tmo = $cobrand->traffic_management_options; + my %tm_lookup = map { $tmo->[$_] => $_ + 1 } 0..$#$tmo; + my $missed_cutoff = $now - DateTime::Duration->new( hours => 24 ); my %params = ( -and => [ @@ -102,7 +105,7 @@ sub construct { my $i = 0; foreach my $inspector_id (keys %$inspectors) { my $inspections = $inspectors->{$inspector_id}; - my $initials = $inspector_initials->{$inspector_id}; + my $initials = $inspector_initials->{$inspector_id} || "XX"; my %body_by_activity_code; foreach my $report (@$inspections) { @@ -116,13 +119,17 @@ sub construct { $location .= " Nearest postcode: $closest_address->{postcode}{postcode}." if $closest_address->{postcode}; } - my $description = sprintf("%s %s", $report->external_id || "", $report->get_extra_metadata('detailed_information') || ""); + my $traffic_information = $report->get_extra_metadata('traffic_information') || 'none'; + my $description = sprintf("%s %s %s %s", + $report->external_id || "", + $initials, + 'TM' . ($tm_lookup{$traffic_information} || '0'), + $report->get_extra_metadata('detailed_information') || ""); + # Maximum length of 180 characters total + $description = substr($description, 0, 180); my $activity_code = $report->defect_type ? $report->defect_type->get_extra_metadata('activity_code') : 'MC'; - my $traffic_information = $report->get_extra_metadata('traffic_information') ? - 'TM ' . $report->get_extra_metadata('traffic_information') - : 'TM none'; $body_by_activity_code{$activity_code} ||= []; $csv->add_row($body_by_activity_code{$activity_code}, @@ -133,7 +140,7 @@ sub construct { $location, # defect location field, which we don't capture from inspectors $report->inspection_log_entry->whenedited->strftime("%H%M"), # defect time raised "","","","","","","", # empty fields - $traffic_information, + "TM $traffic_information", $description, # defect description ); @@ -169,7 +176,7 @@ sub construct { "G", # start of an area/sequence $link_id, # area/link id, fixed value for our purposes "","", # must be empty - $initials || "XX", # inspector initials + $initials, # inspector initials $self->inspection_date->strftime("%y%m%d"), # date of inspection yymmdd "1600", # time of inspection hhmm, set to static value for now "D", # inspection variant, should always be D |