diff options
author | Dave Arter <davea@mysociety.org> | 2019-06-04 15:08:58 +0100 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2019-06-04 15:08:58 +0100 |
commit | f4cbb3b53941ae3cb2816d2b26bf3b6f9db0ca2a (patch) | |
tree | aec402df92dc11e160063115af6b9555a7dd0361 /perllib/Open311/PopulateServiceList.pm | |
parent | 500d4fe948bae1ee5a2d4dab8820c1d0ea9424c2 (diff) | |
parent | 3139d214cdcb606c668793384559480a96819dfa (diff) |
Merge branch 'hounslow-reviewed'
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index ad7288c62..2da67e9cd 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -165,6 +165,7 @@ sub _handle_existing_contact { } $self->_set_contact_group($contact); + $self->_set_contact_non_public($contact); push @{ $self->found_contacts }, $self->_current_service->{service_code}; } @@ -201,6 +202,7 @@ sub _create_contact { } $self->_set_contact_group($contact); + $self->_set_contact_non_public($contact); if ( $contact ) { push @{ $self->found_contacts }, $self->_current_service->{service_code}; @@ -283,6 +285,21 @@ sub _set_contact_group { } } +sub _set_contact_non_public { + my ($self, $contact) = @_; + + # We never want to make a private category unprivate. + return if $contact->non_public; + + my %keywords = map { $_ => 1 } split /,/, ( $self->_current_service->{keywords} || '' ); + $contact->update({ + non_public => 1, + editor => $0, + whenedited => \'current_timestamp', + note => 'marked private automatically by script', + }) if $keywords{private}; +} + sub _delete_contacts_not_in_service_list { my $self = shift; |