diff --git a/bin/whitespace/bexley-service-mapping b/bin/whitespace/bexley-service-mapping deleted file mode 100755 index 1d78cf94..00000000 --- a/bin/whitespace/bexley-service-mapping +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env perl - -BEGIN { - use File::Basename qw(dirname); - use File::Spec; - my $d = dirname(File::Spec->rel2abs($0)); - require "$d/../../setenv.pl"; -} - -use Integrations::Whitespace; - -if ($ARGV[0] eq '-h') { - print "Usage: $0\n"; - print "This script generates the YAML for the service_mapping key of the configuration.\n"; - exit; -} - -my $whitespace = Integrations::Whitespace->new(config_filename => 'bexley_whitespace'); - -my $services = $whitespace->GetServices; - -# Find all services where the ServiceName starts with "Missed" -my @missed_services = grep { $_->{ServiceName} =~ /^Missed/ } @$services; - -my %output; - -for my $service (@missed_services) { - my $service_items = $whitespace->GetServiceItems($service->{ServiceID}); - - for my $service_item (@$service_items) { - push @{ $output{$service_item->{ServiceItemName}} }, { - service_id => $service->{ServiceID}, - service_name => $service->{ServiceName}, - service_item_id => $service_item->{ServiceItemID}, - service_item_description => $service_item->{ServiceItemDescription}, - }; - } - -} - -print "service_mapping:\n"; -for my $service_item_name (keys %output) { - my $service_items = $output{$service_item_name}; - my $service_item = $service_items->[0]; - print " $service_item_name:\n"; - print " service_item_id: " . $service_item->{service_item_id} . " # $service_item->{service_item_description}\n"; - print " service_id: " . $service_item->{service_id} . " # $service_item->{service_name}\n"; - - if (@{ $service_items } > 1) { - print " # Also found " . (scalar @{ $service_items } - 1) . " other related service(s):\n"; - - for my $i (1 .. $#{ $service_items }) { - my $service_item = $service_items->[$i]; - print " # service_id: " . $service_item->{service_id} . " # $service_item->{service_name}\n"; - } - } -} diff --git a/conf/council-bexley_whitespace.yml-example b/conf/council-bexley_whitespace.yml-example index 351faae0..bfec3295 100644 --- a/conf/council-bexley_whitespace.yml-example +++ b/conf/council-bexley_whitespace.yml-example @@ -10,4 +10,16 @@ category_mapping: name: Report missed collection group: Waste -service_mapping: # Replace with output from `bin/whitespace/bexley-service-mapping` +service_mapping: # Copy from staging/live config + FO-23: + service_item_id: 33 # Food 23 ltr Caddy + service_id: 285 # Missed Collection Food + FO-140: + service_item_id: 32 # Food 140 ltr Bin + service_id: 285 # Missed Collection Food + GA-140: + service_item_id: 50 # Garden 140 ltr Bin + service_id: 286 # Missed Collection Garden + GA-240: + service_item_id: 52 # Garden 240 ltr Bin + service_id: 286 # Missed Collection Garden diff --git a/perllib/Open311/Endpoint/Integration/Ezytreev.pm b/perllib/Open311/Endpoint/Integration/Ezytreev.pm index b21fdcd2..d5381381 100644 --- a/perllib/Open311/Endpoint/Integration/Ezytreev.pm +++ b/perllib/Open311/Endpoint/Integration/Ezytreev.pm @@ -75,7 +75,7 @@ sub post_service_request { CRMXRef => $crm_xref, EnquiryDescription => $args->{description}, Forename => $args->{first_name}, - Surname => $args->{last_name}, + Surname => substr($args->{last_name}, 0, 20), Category => "T", # Always T, the actual category goes into EnquiryType below EnquiryType => $args->{service_code}, TelHome => $args->{phone}, diff --git a/perllib/Open311/Endpoint/Integration/UK/Bexley/Symology.pm b/perllib/Open311/Endpoint/Integration/UK/Bexley/Symology.pm index 61239426..194f1ab1 100644 --- a/perllib/Open311/Endpoint/Integration/UK/Bexley/Symology.pm +++ b/perllib/Open311/Endpoint/Integration/UK/Bexley/Symology.pm @@ -80,6 +80,8 @@ sub _update_status { 'investigating' } elsif ($action_due =~ /^PT[CS]|TPHR|REIN$/) { 'action_scheduled' + } elsif ($action_due eq 'ROD') { + 'closed' } elsif ($row->{Stage} == 9 || $row->{Stage} == 8) { undef } else { @@ -91,6 +93,7 @@ sub _update_status { if ($status && ( $status eq 'not_councils_responsibility' || $status eq 'action_scheduled' || $status eq 'no_further_action' + || $status eq 'closed' || $status eq 'internal_referral' )) { $row->{'Event Type'}; } else { diff --git a/t/open311/endpoint/bexley_symology.t b/t/open311/endpoint/bexley_symology.t index 4e7c800e..1c9a9369 100644 --- a/t/open311/endpoint/bexley_symology.t +++ b/t/open311/endpoint/bexley_symology.t @@ -130,7 +130,8 @@ $bexley_end->mock(_get_update_files => sub { 17/04/2019 13:53,04/04/2019,560058,RECORDED,,SI6,SI6MOB,IR,RES,1 17/04/2019 14:06,04/04/2019,560062,RECORDED,,SI5,NCR,N1,,1 17/04/2019 14:07,04/04/2019,560062,RECORDED,,SI5,NCR,RPOS,,1 -17/04/2019 14:08,04/04/2019,560062,RECORDED,,SI5,NCR,CR,,1 +17/04/2019 14:08,04/04/2019,560062,RECORDED,,SI5,NCR,ROD,FOO,1 +17/04/2019 14:09,04/04/2019,560062,RECORDED,,SI5,NCR,CR,,1 EOF \< @@ -613,9 +614,18 @@ subtest "GET updates OK" => sub { "media_url" => "", }, { - "update_id" => "560062_94e427db", + "update_id" => "560062_6181418a", "updated_datetime" => "2019-04-17T14:08:00+01:00", "service_request_id" => "560062", + "status" => "closed", + "description" => "", + "media_url" => "", + "external_status_code" => 'FOO', + }, + { + "update_id" => "560062_2e55f431", + "updated_datetime" => "2019-04-17T14:09:00+01:00", + "service_request_id" => "560062", "status" => "fixed", "description" => "", "media_url" => "",