aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-09-27 14:46:46 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-09-30 15:04:06 +0100
commitc7d98f98bf4faa1a60552dd11195eb134445b6b3 (patch)
tree47028cce45ce2ac77c5208f18bdb02b45d7220c2 /perllib/Open311.pm
parentd0ae2a420905dbd0b79141d88e2c47956d1d65b2 (diff)
Adapt things that assume email will be present.
This includes stopping some emails being sent (moderation, alert, questionnaire), dealing with Open311/email report sending, and tokenised_url.
Diffstat (limited to 'perllib/Open311.pm')
-rw-r--r--perllib/Open311.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/perllib/Open311.pm b/perllib/Open311.pm
index da5a0a377..90b593256 100644
--- a/perllib/Open311.pm
+++ b/perllib/Open311.pm
@@ -127,13 +127,15 @@ sub _populate_service_request_params {
my ( $firstname, $lastname ) = ( $problem->name =~ /(\w+)\.?\s+(.+)/ );
my $params = {
- email => $problem->user->email,
description => $description,
service_code => $service_code,
first_name => $firstname,
last_name => $lastname || '',
};
+ $params->{phone} = $problem->user->phone if $problem->user->phone;
+ $params->{email} = $problem->user->email if $problem->user->email;
+
# if you click nearby reports > skip map then it's possible
# to end up with used_map = f and nothing in postcode
if ( $problem->used_map || $self->always_send_latlong
@@ -153,10 +155,6 @@ sub _populate_service_request_params {
$params->{address_string} = $problem->postcode;
}
- if ( $problem->user->phone ) {
- $params->{ phone } = $problem->user->phone;
- }
-
if ( $extra->{image_url} ) {
$params->{media_url} = $extra->{image_url};
}
@@ -327,12 +325,14 @@ sub _populate_service_request_update_params {
updated_datetime => DateTime::Format::W3CDTF->format_datetime($comment->confirmed->set_nanosecond(0)),
service_request_id => $comment->problem->external_id,
status => $status,
- email => $comment->user->email,
description => $comment->text,
last_name => $lastname,
first_name => $firstname,
};
+ $params->{phone} = $comment->user->phone if $comment->user->phone;
+ $params->{email} = $comment->user->email if $comment->user->email;
+
if ( $self->use_extended_updates ) {
$params->{public_anonymity_required} = $comment->anonymous ? 'TRUE' : 'FALSE',
$params->{update_id_ext} = $comment->id;