aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-04-28 16:42:48 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-04-28 16:42:48 +0100
commit3c89f10b779fcecbb7453b7e0db01aaf72f9ae25 (patch)
tree079c7c524906aa1e745c1c563b368ecef123aabc
parentf76f140d7dedbb9009e40e216da1f6d337f440e0 (diff)
parent26f5223d57cfbcf35cde67d23c276fcb86e16cf3 (diff)
Merge branch 'peterborough-skanska-ref'
-rw-r--r--perllib/FixMyStreet/Cobrand/Peterborough.pm13
-rw-r--r--t/cobrand/peterborough.t2
2 files changed, 15 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Peterborough.pm b/perllib/FixMyStreet/Cobrand/Peterborough.pm
index 882bef7eb..0ddaeacb6 100644
--- a/perllib/FixMyStreet/Cobrand/Peterborough.pm
+++ b/perllib/FixMyStreet/Cobrand/Peterborough.pm
@@ -40,6 +40,19 @@ sub geocoder_munge_results {
sub admin_user_domain { "peterborough.gov.uk" }
+around open311_extra_data => sub {
+ my ($orig, $self, $row, $h, $extra) = @_;
+
+ my $open311_only = $self->$orig($row, $h, $extra);
+ foreach (@$open311_only) {
+ if ($_->{name} eq 'description') {
+ my ($ref) = grep { $_->{name} =~ /pcc-Skanska-csc-ref/i } @{$row->get_extra_fields};
+ $_->{value} .= "\n\nSkanska CSC ref: $ref->{value}" if $ref;
+ }
+ }
+ return $open311_only;
+};
+
# remove categories which are informational only
sub open311_pre_send {
my ($self, $row, $open311) = @_;
diff --git a/t/cobrand/peterborough.t b/t/cobrand/peterborough.t
index d61b3de75..5d07acb9f 100644
--- a/t/cobrand/peterborough.t
+++ b/t/cobrand/peterborough.t
@@ -25,6 +25,7 @@ subtest 'open311 request handling', sub {
$p->push_extra_fields({ name => 'emergency', value => 'no'});
$p->push_extra_fields({ name => 'private_land', value => 'no'});
$p->push_extra_fields({ name => 'PCC-light', value => 'whatever'});
+ $p->push_extra_fields({ name => 'PCC-skanska-csc-ref', value => '1234'});
$p->push_extra_fields({ name => 'tree_code', value => 'tree-42'});
$p->update;
@@ -38,6 +39,7 @@ subtest 'open311 request handling', sub {
my $req = $test_data->{test_req_used};
my $c = CGI::Simple->new($req->content);
+ is $c->param('attribute[description]'), "Title Test 1 for " . $peterborough->id . " Detail\r\n\r\nSkanska CSC ref: 1234", 'Ref added to description';
is $c->param('attribute[emergency]'), undef, 'no emergency param sent';
is $c->param('attribute[private_land]'), undef, 'no private_land param sent';
is $c->param('attribute[PCC-light]'), undef, 'no pcc- param sent';