aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/Cobrand/Harrogate.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/Cobrand/Harrogate.pm')
-rw-r--r--perllib/FixMyStreet/Cobrand/Harrogate.pm46
1 files changed, 44 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/Cobrand/Harrogate.pm b/perllib/FixMyStreet/Cobrand/Harrogate.pm
index 6bcc2f227..afda52385 100644
--- a/perllib/FixMyStreet/Cobrand/Harrogate.pm
+++ b/perllib/FixMyStreet/Cobrand/Harrogate.pm
@@ -112,7 +112,9 @@ sub temp_update_contacts {
}
$contact->update({
- extra => [ { %default, %$field } ],
+ # XXX: we're just setting extra with the expected layout,
+ # this could be encapsulated more nicely
+ extra => { _fields => [ { %default, %$field } ] },
confirmed => 1,
deleted => 0,
editor => 'automated script',
@@ -223,7 +225,7 @@ sub process_additional_metadata_for_email {
my ($self, $problem, $h) = @_;
my $additional = '';
- if (my $extra = $problem->extra) {
+ if (my $extra = $problem->get_extra_fields) {
$additional = join "\n\n", map {
if ($_->{name} eq 'INFO_TEXT') {
();
@@ -238,5 +240,45 @@ sub process_additional_metadata_for_email {
$h->{additional_information} = $additional;
}
+sub send_questionnaires {
+ return 0;
+}
+
+sub munge_category_list {
+ my ($self, $categories_ref, $contacts_ref, $extras_ref) = @_;
+
+ # we want to know which contacts *only* belong to NYCC
+ # that's because for shared responsibility, we don't expect
+ # the user to have to figure out which authority to contact.
+
+ # so we start building up the list of both
+ my (%harrogate_contacts, %nycc_contacts);
+
+ my $harrogate_id = $self->council_id; # XXX: note reference to council_id as body id!
+ for my $contact (@$contacts_ref) {
+ my $category = $contact->category;
+ if ($contact->body_id == $harrogate_id) {
+ $harrogate_contacts{$category} = 1;
+ }
+ else {
+ $nycc_contacts{$category}++;
+ }
+ }
+
+ # and then remove any that also have Harrogate involvement
+ delete $nycc_contacts{$_} for keys %harrogate_contacts;
+
+ # here, we simply *mark* the text with (NYCC) at the end, and
+ # the rest will get done in the template with javascript
+ my @categories = map {
+ $nycc_contacts{$_} ?
+ "$_ (NYCC)"
+ : $_
+ } @$categories_ref;
+
+ # replace the entire list with this transformed one
+ @$categories_ref = @categories;
+}
+
1;