aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/Bodies.pm5
-rw-r--r--perllib/Open311/PopulateServiceList.pm5
2 files changed, 8 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
index 4bfca21ae..6ae068cd9 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/Bodies.pm
@@ -272,6 +272,11 @@ sub update_contact : Private {
} else {
$contact->unset_extra_metadata( 'photo_required' );
}
+ if ( $c->get_param('open311_protect') ) {
+ $contact->set_extra_metadata( open311_protect => 1 );
+ } else {
+ $contact->unset_extra_metadata( 'open311_protect' );
+ }
if ( my @group = $c->get_param_list('group') ) {
@group = grep { $_ } @group;
if (scalar @group == 0) {
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index eb1d76da4..9be17946e 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -143,6 +143,7 @@ sub _handle_existing_contact {
my ( $self, $contact ) = @_;
my $service_name = $self->_normalize_service_name;
+ my $protected = $contact->get_extra_metadata("open311_protect");
print $self->_current_body->id . " already has a contact for service code " . $self->_current_service->{service_code} . "\n" if $self->verbose >= 2;
@@ -150,7 +151,7 @@ sub _handle_existing_contact {
eval {
$contact->update(
{
- category => $service_name,
+ $protected ? () : (category => $service_name),
email => $self->_current_service->{service_code},
state => 'confirmed',
%{ $self->_action_params("undeleted") },
@@ -178,7 +179,7 @@ sub _handle_existing_contact {
$contact->update;
}
- $self->_set_contact_group($contact);
+ $self->_set_contact_group($contact) unless $protected;
$self->_set_contact_non_public($contact);
push @{ $self->found_contacts }, $self->_current_service->{service_code};