aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/PopulateServiceList.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r--perllib/Open311/PopulateServiceList.pm61
1 files changed, 41 insertions, 20 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index 30d888eb4..f10bdf7fb 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -237,9 +237,36 @@ sub _add_meta_to_contact {
# Some Open311 endpoints, such as Bromley and Warwickshire send <metadata>
# for attributes which we *don't* want to display to the user (e.g. as
# fields in "category_extras"
+ $self->_add_meta_to_contact_cobrand_overrides($contact, \@meta);
+
+ $contact->set_extra_fields(@meta);
+ $contact->update;
+}
+
+sub _add_meta_to_contact_cobrand_overrides {
+ my ( $self, $contact, $meta ) = @_;
if ($self->_current_body->name eq 'Bromley Council') {
$contact->set_extra_metadata( id_field => 'service_request_id_ext');
+ # Lights we want to store feature ID, PROW on all categories.
+ push @$meta, {
+ code => 'prow_reference',
+ datatype => 'string',
+ description => 'Right of way reference',
+ order => 101,
+ required => 'false',
+ variable => 'true',
+ automated => 'hidden_field',
+ };
+ push @$meta, {
+ code => 'feature_id',
+ datatype => 'string',
+ description => 'Feature ID',
+ order => 100,
+ required => 'false',
+ variable => 'true',
+ automated => 'hidden_field',
+ } if $self->_current_service->{service_code} eq 'LIGHTS';
} elsif ($self->_current_body->name eq 'Warwickshire County Council') {
$contact->set_extra_metadata( id_field => 'external_id');
}
@@ -256,7 +283,7 @@ sub _add_meta_to_contact {
public_anonymity_required
email_alerts_requested
) ],
- #2243,
+ #2243,
'Warwickshire County Council' => [qw(
closest_address
) ],
@@ -264,11 +291,8 @@ sub _add_meta_to_contact {
if (my $override = $override{ $self->_current_body->name }) {
my %ignore = map { $_ => 1 } @{ $override };
- @meta = grep { ! $ignore{ $_->{ code } } } @meta;
+ @$meta = grep { ! $ignore{ $_->{ code } } } @$meta;
}
-
- $contact->set_extra_fields(@meta);
- $contact->update;
}
sub _normalize_service_name {
@@ -296,25 +320,16 @@ sub _delete_contacts_not_in_service_list {
}
);
- # for Warwickshire/Bristol, which are mixed Open311 and email, don't delete
- # the email addresses
- if ($self->_current_body->name eq 'Warwickshire County Council' ||
- $self->_current_body->name eq 'Bristol City Council') {
+ if ($self->_current_body->can_be_devolved) {
+ # If the body has can_be_devolved switched on, it's most likely a
+ # combination of Open311/email, so ignore any email addresses.
$found_contacts = $found_contacts->search(
- {
- email => { -not_like => '%@%' }
- }
- );
- } elsif ($self->_current_body->name eq 'East Hertfordshire District Council') {
- # For EHDC we need to leave the 'Other' category alone or reports made
- # in this category will be sent only to Hertfordshire County Council.
- $found_contacts = $found_contacts->search(
- {
- category => { '!=' => 'Other' }
- }
+ { email => { -not_like => '%@%' } }
);
}
+ $found_contacts = $self->_delete_contacts_not_in_service_list_cobrand_overrides($found_contacts);
+
$found_contacts->update(
{
state => 'deleted',
@@ -325,4 +340,10 @@ sub _delete_contacts_not_in_service_list {
);
}
+sub _delete_contacts_not_in_service_list_cobrand_overrides {
+ my ( $self, $found_contacts ) = @_;
+
+ return $found_contacts;
+}
+
1;