diff options
-rw-r--r-- | t/cobrand/tfl.t | 23 | ||||
-rw-r--r-- | templates/email/tfl/submit.html | 6 | ||||
-rw-r--r-- | templates/email/tfl/submit.txt | 4 |
3 files changed, 27 insertions, 6 deletions
diff --git a/t/cobrand/tfl.t b/t/cobrand/tfl.t index 85f2092c7..c65239a78 100644 --- a/t/cobrand/tfl.t +++ b/t/cobrand/tfl.t @@ -35,11 +35,19 @@ my $contact1 = $mech->create_contact_ok( email => 'busstops@example.com', ); $contact1->set_extra_metadata(group => [ 'Bus things' ]); -$contact1->set_extra_fields({ - code => 'leaning', - description => 'Is the pole leaning?', - datatype => 'string', -}); +$contact1->set_extra_fields( + { + code => 'leaning', + description => 'Is the pole leaning?', + datatype => 'string', + }, + { + code => 'stop_code', + description => 'Stop number', + datatype => 'string', + automated => 'hidden_field', + } +); $contact1->update; my $contact2 = $mech->create_contact_ok( body_id => $body->id, @@ -291,8 +299,10 @@ subtest "test report creation and reference number" => sub { $mech->log_out_ok; }; -subtest "reference number included in email" => sub { +subtest "extra information included in email" => sub { my $report = FixMyStreet::DB->resultset("Problem")->find({ title => 'Test Report 1'}); + $report->set_extra_fields({ name => 'stop_code', value => '12345678' }); + $report->update; my $id = $report->id; $mech->clear_emails_ok; @@ -300,6 +310,7 @@ subtest "reference number included in email" => sub { my @email = $mech->get_email; is $email[0]->header('To'), 'TfL <busstops@example.com>'; like $mech->get_text_body_from_email($email[0]), qr/Report reference: FMS$id/, "FMS-prefixed ID in TfL email"; + like $mech->get_text_body_from_email($email[0]), qr/Stop number: 12345678/, "Bus stop code in TfL email"; is $email[1]->header('To'), $report->user->email; like $mech->get_text_body_from_email($email[1]), qr/report's reference number is FMS$id/, "FMS-prefixed ID in reporter email"; $mech->clear_emails_ok; diff --git a/templates/email/tfl/submit.html b/templates/email/tfl/submit.html index b7f9bb6df..52c8602f4 100644 --- a/templates/email/tfl/submit.html +++ b/templates/email/tfl/submit.html @@ -51,6 +51,12 @@ of a local problem that they believe might require your attention.</p> <h2 style="[% h2_style %]">[% report.title | html %]</h2> <p style="[% secondary_p_style %]"><strong>Report reference:</strong> FMS[% report.id %]</p> <p style="[% secondary_p_style %]"><strong>Category:</strong> [% report.category | html %]</p> + [% IF report.get_extra_field_value('stop_code') %] + <p style="[% secondary_p_style %]"><strong>Stop number:</strong> [% report.get_extra_field_value('stop_code') | html %]</p> + [% END %] + [% IF report.get_extra_field_value('site') %] + <p style="[% secondary_p_style %]"><strong>Signal site number:</strong> [% report.get_extra_field_value('site') | html %]</p> + [% END %] <p style="[% secondary_p_style %]">[% report.detail | html %]</p> [%~ IF additional_information %] <p style="[% secondary_p_style %]">[% additional_information %]</p> diff --git a/templates/email/tfl/submit.txt b/templates/email/tfl/submit.txt index c99ed24c2..b6af867ff 100644 --- a/templates/email/tfl/submit.txt +++ b/templates/email/tfl/submit.txt @@ -23,6 +23,10 @@ Report reference: FMS[% report.id %] Category: [% report.category %] +[% IF report.get_extra_field_value('stop_code') %]Stop number: [% report.get_extra_field_value('stop_code') %] +[% END %] +[% IF report.get_extra_field_value('site') %]Signal site number: [% report.get_extra_field_value('site') %] +[% END %] Subject: [% report.title %] Details: [% report.detail %] |