aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorM Somerville <matthew-github@dracos.co.uk>2020-08-21 13:01:55 +0100
committerM Somerville <matthew-github@dracos.co.uk>2020-11-11 10:29:20 +0000
commit5e645b3e795e0d9a60425f0d8240c2263dc5a89d (patch)
tree0623cbcdf7ecc54725beba2a506549ac774134bb /perllib
parent45bd2f6427e81890fde87748280d6f75370bb13d (diff)
[Bromley] Check templates for completion message.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/Bromley.pm11
-rw-r--r--perllib/Integrations/Echo.pm2
2 files changed, 11 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Bromley.pm b/perllib/FixMyStreet/Cobrand/Bromley.pm
index 8175138ed..c984f1728 100644
--- a/perllib/FixMyStreet/Cobrand/Bromley.pm
+++ b/perllib/FixMyStreet/Cobrand/Bromley.pm
@@ -571,7 +571,16 @@ sub bin_services_for_address {
my $ref = join(',', @{$_->{Ref}{Value}{anyType}});
my $completed = construct_bin_date($_->{CompletedDate});
my $state = $_->{State}{Name} || '';
+
my $resolution = $_->{Resolution}{Name} || '';
+ my $resolution_id = $_->{Resolution}{Ref}{Value}{anyType};
+ if ($resolution_id) {
+ my $template = FixMyStreet::DB->resultset('ResponseTemplate')->search({
+ 'me.body_id' => $self->body->id,
+ 'me.external_status_code' => $resolution_id,
+ })->first;
+ $resolution = $template->text if $template;
+ }
my $row = $task_ref_to_row{$ref};
$row->{last}{state} = $state;
@@ -581,7 +590,7 @@ sub bin_services_for_address {
if (!$completed && $row->{last}{date}->ymd eq $now->ymd) {
$row->{report_allowed} = 0;
}
- if ($state eq 'Not Completed' || ($state eq 'Completed' && $resolution eq 'Excess Waste')) {
+ if ($state eq 'Not Completed' || ($state eq 'Completed' && $_->{Resolution}{Name} eq 'Excess Waste')) {
$row->{report_allowed} = 0;
$row->{report_locked_out} = 1;
}
diff --git a/perllib/Integrations/Echo.pm b/perllib/Integrations/Echo.pm
index d8608708e..5878cdfa1 100644
--- a/perllib/Integrations/Echo.pm
+++ b/perllib/Integrations/Echo.pm
@@ -93,7 +93,7 @@ sub GetTasks {
{
Ref => { Value => { anyType => [ 123, 456 ] } },
State => { Name => 'Completed' },
- Resolution => { Name => 'Wrong Bin Out' },
+ Resolution => { Ref => { Value => { anyType => 187 } }, Name => 'Wrong Bin Out' },
CompletedDate => { DateTime => '2020-05-27T10:00:00Z' }
},
{