aboutsummaryrefslogtreecommitdiffstats
path: root/perllib
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2020-04-29 12:31:06 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-05-06 15:52:35 +0100
commit30dfd35daaf0424b2e2bc126485952c26ac9d310 (patch)
treea5693280ddeda3cb2a6414fe11b130d1bc950af4 /perllib
parent511fd9b952d62b1a4671a676d83a07ba4007b22a (diff)
[East Sussex] Fix sending of notices, tidy up.
variable is the string 'true' or 'false' from Open311. Store the original detail so we can reset back to it more easily.
Diffstat (limited to 'perllib')
-rw-r--r--perllib/FixMyStreet/Cobrand/EastSussex.pm28
1 files changed, 10 insertions, 18 deletions
diff --git a/perllib/FixMyStreet/Cobrand/EastSussex.pm b/perllib/FixMyStreet/Cobrand/EastSussex.pm
index c113a0986..e6c2da6c5 100644
--- a/perllib/FixMyStreet/Cobrand/EastSussex.pm
+++ b/perllib/FixMyStreet/Cobrand/EastSussex.pm
@@ -6,36 +6,28 @@ use warnings;
sub council_area_id { return 2224; }
-sub open311_pre_send {
- my ($self, $row, $open311) = @_;
+sub open311_extra_data {
+ my ($self, $row, $h, $extra, $contact) = @_;
- my $contact = $row->category_row;
+ $h->{es_original_detail} = $row->detail;
+
+ $contact = $row->category_row;
my $fields = $contact->get_extra_fields;
+ my $text = '';
for my $field ( @$fields ) {
- if ($field->{variable} && !$field->{automated}) {
- my $text = $row->detail;
+ if (($field->{variable} || '') eq 'true' && !$field->{automated}) {
my $q = $row->get_extra_field_value( $field->{code} ) || '';
$text .= "\n\n" . $field->{description} . "\n" . $q;
- $row->detail($text);
}
}
+ $row->detail($row->detail . $text);
+ return ();
}
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);
+ $row->detail($h->{es_original_detail});
}
1;