diff options
author | Dave Arter <davea@mysociety.org> | 2020-04-27 12:46:21 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2020-04-28 10:33:53 +0100 |
commit | ed896ab1844a903458cba995d7fb70b8b582f950 (patch) | |
tree | bdf276cd6861beaf700ef76ae8561c4ffd345a74 /perllib/Open311/PopulateServiceList.pm | |
parent | 813d8a0273764b6215e739f268dc7243d768a205 (diff) |
Add contact flag to protect category/group names from Open311 changes
Adds a new tickbox to the contact editing form that protects the category
and group names from being changed by Open311.
For mysociety/fixmystreet-commercial#1776
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 5 |
1 files changed, 3 insertions, 2 deletions
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}; |