aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/DB/Result/Problem.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/Problem.pm')
-rw-r--r--perllib/FixMyStreet/DB/Result/Problem.pm81
1 files changed, 0 insertions, 81 deletions
diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm
index 42983c9ad..0653de32b 100644
--- a/perllib/FixMyStreet/DB/Result/Problem.pm
+++ b/perllib/FixMyStreet/DB/Result/Problem.pm
@@ -838,87 +838,6 @@ sub local_coords {
}
}
-=head2 update_from_open311_service_request
-
- $p->update_from_open311_service_request( $request, $body, $system_user );
-
-Updates the problem based on information in the passed in open311 request
-(standard, not the extension that uses GetServiceRequestUpdates) . If the
-request has an older update time than the problem's lastupdate time then
-nothing happens.
-
-Otherwise a comment will be created if there is status update text in the
-open311 request. If the open311 request has a state of closed then the problem
-will be marked as fixed.
-
-NB: a comment will always be created if the problem is being marked as fixed.
-
-Fixed problems will not be re-opened by this method.
-
-=cut
-
-sub update_from_open311_service_request {
- my ( $self, $request, $body, $system_user ) = @_;
-
- my ( $updated, $status_notes );
-
- if ( ! ref $request->{updated_datetime} ) {
- $updated = $request->{updated_datetime};
- }
-
- if ( ! ref $request->{status_notes} ) {
- $status_notes = $request->{status_notes};
- }
-
- my $update = $self->new_related(comments => {
- state => 'confirmed',
- created => $updated || \'current_timestamp',
- confirmed => \'current_timestamp',
- text => $status_notes,
- mark_open => 0,
- mark_fixed => 0,
- user => $system_user,
- anonymous => 0,
- name => $body->name,
- });
-
- my $w3c = DateTime::Format::W3CDTF->new;
- my $req_time = $w3c->parse_datetime( $request->{updated_datetime} );
-
- # set a timezone here as the $req_time will have one and if we don't
- # use a timezone then the date comparisons are invalid.
- # of course if local timezone is not the one that went into the data
- # base then we're also in trouble
- my $lastupdate = $self->lastupdate;
- $lastupdate->set_time_zone( FixMyStreet->local_time_zone );
-
- # update from open311 is older so skip
- if ( $req_time < $lastupdate ) {
- return 0;
- }
-
- if ( $request->{status} eq 'closed' ) {
- if ( $self->state ne 'fixed' ) {
- $self->state('fixed');
- $update->mark_fixed(1);
-
- if ( !$status_notes ) {
- # FIXME - better text here
- $status_notes = _('Closed by council');
- }
- }
- }
-
- if ( $status_notes ) {
- $update->text( $status_notes );
- $self->lastupdate( $req_time );
- $self->update;
- $update->insert;
- }
-
- return 1;
-}
-
sub update_send_failed {
my $self = shift;
my $msg = shift;