diff options
author | Dave Arter <davea@mysociety.org> | 2017-12-05 12:38:36 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2017-12-05 12:38:36 +0000 |
commit | ff1fec27a51aa8c2f8ff6c74cc0a97d4739ba8ed (patch) | |
tree | b92c37a4d22ee1e3b431c203a8f552a4ba660f60 /perllib/Open311/PopulateServiceList.pm | |
parent | 6c2290663217efd2aab807448b321868866e0bc5 (diff) | |
parent | 509effcbcdf0f193c3dda787e7659b8ee6ea3ed1 (diff) |
Merge branch 'issues/forcouncils/40-open311-groups'
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r-- | perllib/Open311/PopulateServiceList.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm index dbd0d1c68..e8d06efdf 100644 --- a/perllib/Open311/PopulateServiceList.pm +++ b/perllib/Open311/PopulateServiceList.pm @@ -156,7 +156,13 @@ sub _handle_existing_contact { if ( $contact and lc($metadata) eq 'true' ) { $self->_add_meta_to_contact( $contact ); } elsif ( $contact and $contact->extra and lc($metadata) eq 'false' ) { - $contact->update( { extra => undef } ); + $contact->set_extra_fields(); + $contact->update; + } + + if (my $group = $self->_current_service->{group}) { + $contact->set_extra_metadata(group => $group); + $contact->update; } push @{ $self->found_contacts }, $self->_current_service->{service_code}; @@ -182,6 +188,12 @@ sub _create_contact { ); }; + if (my $group = $self->_current_service->{group}) { + $contact->set_extra_metadata(group => $group); + $contact->update; + } + + if ( $@ ) { warn "Failed to create contact for service code " . $self->_current_service->{service_code} . " for body @{[$self->_current_body->id]}: $@\n" if $self->verbose >= 1; |