From d66a953b31c3617ffa8c1af969fcc973732f231c Mon Sep 17 00:00:00 2001 From: Struan Donald Date: Tue, 11 Sep 2018 12:47:54 +0100 Subject: [Open311] add customer reference from update to problem If an Open311 update has a customer_reference property then add that to the metadata for the problem. --- perllib/Open311/GetServiceRequestUpdates.pm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'perllib/Open311/GetServiceRequestUpdates.pm') diff --git a/perllib/Open311/GetServiceRequestUpdates.pm b/perllib/Open311/GetServiceRequestUpdates.pm index 480a78cf1..fa852a80d 100644 --- a/perllib/Open311/GetServiceRequestUpdates.pm +++ b/perllib/Open311/GetServiceRequestUpdates.pm @@ -115,6 +115,7 @@ sub update_comments { my $state = $open311->map_state( $request->{status} ); my $old_state = $p->state; my $external_status_code = $request->{external_status_code} || ''; + my $customer_reference = $request->{customer_reference} || ''; my $old_external_status_code = $p->get_extra_metadata('external_status_code') || ''; my $comment = $self->schema->resultset('Comment')->new( { @@ -143,6 +144,12 @@ sub update_comments { $p->set_extra_metadata(external_status_code => $external_status_code); } + # if the customer reference to display in the report metadata is + # not the same as the external_id + if ( $customer_reference ) { + $p->set_extra_metadata( customer_reference => $customer_reference ); + } + $open311->add_media($request->{media_url}, $comment) if $request->{media_url}; -- cgit v1.2.3