aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/PopulateServiceList.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-07-14 16:25:31 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-07-14 16:25:31 +0100
commit8c3f0fbfb4bcd33fa8dbc93c2ecb8e0f25ebf383 (patch)
tree0b596b32bc9248d10e6f4409e39d3285e957d40a /perllib/Open311/PopulateServiceList.pm
parent298db521933eb65591fafa218e78f5f4cdb547ad (diff)
parent426bc926a422af21ff39cebed836d34e46238500 (diff)
Merge branch 'issues/forcouncils/192-unused-categories'
Diffstat (limited to 'perllib/Open311/PopulateServiceList.pm')
-rw-r--r--perllib/Open311/PopulateServiceList.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/perllib/Open311/PopulateServiceList.pm b/perllib/Open311/PopulateServiceList.pm
index c5f17334b..540425bf1 100644
--- a/perllib/Open311/PopulateServiceList.pm
+++ b/perllib/Open311/PopulateServiceList.pm
@@ -131,14 +131,13 @@ sub _handle_existing_contact {
print $self->_current_body->id . " already has a contact for service code " . $self->_current_service->{service_code} . "\n" if $self->verbose >= 2;
- if ( $contact->deleted || $service_name ne $contact->category || $self->_current_service->{service_code} ne $contact->email ) {
+ if ( $contact->state eq 'deleted' || $service_name ne $contact->category || $self->_current_service->{service_code} ne $contact->email ) {
eval {
$contact->update(
{
category => $service_name,
email => $self->_current_service->{service_code},
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'automatically undeleted by script',
@@ -175,8 +174,7 @@ sub _create_contact {
email => $self->_current_service->{service_code},
body_id => $self->_current_body->id,
category => $service_name,
- confirmed => 1,
- deleted => 0,
+ state => 'confirmed',
editor => $0,
whenedited => \'current_timestamp',
note => 'created automatically by script',
@@ -278,11 +276,10 @@ sub _normalize_service_name {
sub _delete_contacts_not_in_service_list {
my $self = shift;
- my $found_contacts = $self->schema->resultset('Contact')->search(
+ my $found_contacts = $self->schema->resultset('Contact')->not_deleted->search(
{
email => { -not_in => $self->found_contacts },
body_id => $self->_current_body->id,
- deleted => 0,
}
);
@@ -299,7 +296,7 @@ sub _delete_contacts_not_in_service_list {
$found_contacts->update(
{
- deleted => 1,
+ state => 'deleted',
editor => $0,
whenedited => \'current_timestamp',
note => 'automatically marked as deleted by script'