aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2020-04-15 13:48:49 +0100
committerStruan Donald <struan@exo.org.uk>2020-04-29 10:09:29 +0100
commit4f9f8e20121cda727beef8c5e3b25e9e187a8d81 (patch)
tree07da603959934888fb932e0d5ffcdaedf500e42f /perllib
parentb896b5a095137bf8f6b0fe8e35f6604387c7e877 (diff)
[East Sussex] add additional question to text for open311
The extra question data is added here rather than in the adapter as we have the question text along with the answer here.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/EastSussex.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/Cobrand/EastSussex.pm b/perllib/FixMyStreet/Cobrand/EastSussex.pm
index be04b75dd..c113a0986 100644
--- a/perllib/FixMyStreet/Cobrand/EastSussex.pm
+++ b/perllib/FixMyStreet/Cobrand/EastSussex.pm
@@ -6,4 +6,36 @@ use warnings;
sub council_area_id { return 2224; }
+sub open311_pre_send {
+ my ($self, $row, $open311) = @_;
+
+ my $contact = $row->category_row;
+ my $fields = $contact->get_extra_fields;
+ for my $field ( @$fields ) {
+ if ($field->{variable} && !$field->{automated}) {
+ my $text = $row->detail;
+ my $q = $row->get_extra_field_value( $field->{code} ) || '';
+ $text .= "\n\n" . $field->{description} . "\n" . $q;
+ $row->detail($text);
+ }
+ }
+}
+
+sub open311_post_send {
+ my ($self, $row, $h, $contact) = @_;
+
+ my $fields = $contact->get_extra_fields;
+ my $text = $row->detail;
+ my $added = '';
+ for my $field ( @$fields ) {
+ if ($field->{variable} && !$field->{automated}) {
+ my $q = $row->get_extra_field_value( $field->{code} ) || '';
+ $added .= "\n\n" . $field->{description} . "\n" . $q;
+ }
+ }
+
+ $text =~ s/\Q$added\E//;
+ $row->detail($text);
+}
+
1;