Skip to content

Commit

Permalink
[Bromley] Include extra information in description
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismytton authored and dracos committed Feb 12, 2025
1 parent ba7d2fc commit 7c6aeb4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions perllib/FixMyStreet/Cobrand/Bromley.pm
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,16 @@ sub open311_pre_send {
$row->detail($text);
}
}

# Any special extra questions to include
my $extra = $row->get_extra_fields;
foreach (@$extra) {
if ($_->{name} =~ /_Q$/ && $_->{value}) {
(my $name = ucfirst lc $_->{name}) =~ s/_q//;
my $text = "$name information: " . $_->{value} . "\n\n" . $row->detail;
$row->detail($text);
}
}
}

sub _include_user_title_in_extra {
Expand Down
21 changes: 21 additions & 0 deletions t/cobrand/bromley.t
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,27 @@ subtest 'Private comments on updates are added to open311 description' => sub {
};
};

subtest 'ensure flytip information is added to open311 description' => sub {
$report->set_extra_fields({ name => 'FLYTIP_Q', value => 'Large sofa and household waste' });
$report->send_state('unprocessed');
$report->update;

FixMyStreet::override_config {
STAGING_FLAGS => { send_reports => 1 },
ALLOWED_COBRANDS => [ 'fixmystreet', 'bromley' ],
MAPIT_URL => 'http://mapit.uk/',
}, sub {
FixMyStreet::Script::Reports::send();
};

$report->discard_changes;
is $report->send_state, 'sent', 'Report marked as sent';

my $req = Open311->test_req_used;
my $c = CGI::Simple->new($req->content);
like $c->param('description'), qr/Flytip information: Large sofa and household waste/, 'flytip information included in description';
};

for my $test (
{
cobrand => 'bromley',
Expand Down

0 comments on commit 7c6aeb4

Please sign in to comment.