diff options
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; |