diff options
Diffstat (limited to 'perllib/FixMyStreet')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/Reports.pm | 2 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/Bexley.pm | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm index 2cfb67306..c57b207e2 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/Reports.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/Reports.pm @@ -382,7 +382,7 @@ sub edit_category : Private { my ($self, $c, $problem, $no_comment) = @_; if ((my $category = $c->get_param('category')) ne $problem->category) { - my $force_resend = $c->cobrand->call_hook('category_change_force_resend'); + my $force_resend = $c->cobrand->call_hook('category_change_force_resend', $problem->category, $category); my $disable_resend = $c->cobrand->call_hook('disable_resend'); my $category_old = $problem->category; $problem->category($category); diff --git a/perllib/FixMyStreet/Cobrand/Bexley.pm b/perllib/FixMyStreet/Cobrand/Bexley.pm index 6ec2b6f50..bbef4154b 100644 --- a/perllib/FixMyStreet/Cobrand/Bexley.pm +++ b/perllib/FixMyStreet/Cobrand/Bexley.pm @@ -29,6 +29,24 @@ sub disambiguate_location { sub disable_resend_button { 1 } +# We can resend reports upon category change, unless it will be going to the +# same Symology database, because that will reject saying it already has the +# ID. +sub category_change_force_resend { + my ($self, $old, $new) = @_; + + # Get the Open311 identifiers + my $contacts = $self->{c}->stash->{contacts}; + ($old) = map { $_->email } grep { $_->category eq $old } @$contacts; + ($new) = map { $_->email } grep { $_->category eq $new } @$contacts; + + # Okay if we're switching to/from/within Confirm/Uniform + return 1 if $old =~ /^(Confirm|Uniform)/ || $new =~ /^(Confirm|Uniform)/; + + # Otherwise, okay if we're switching between Symology DBs, but not within + return ($old =~ /^StreetLighting/ xor $new =~ /^StreetLighting/); +} + sub on_map_default_status { 'open' } sub open311_munge_update_params { |