aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Open311/GetServiceRequestUpdates.pm
Commit message (Collapse)AuthorAgeLines
* [open311] unset the external_status_code if blankStruan Donald2019-07-31-0/+2
| | | | | | If an update with a blank external_status_code is fetched then unset it otherwise we will always a detect a change in the external_status_code which might mean phantom updates.
* [Open311] Refactor GetServiceRequestUpdates a bit.Matthew Somerville2019-07-15-129/+151
|
* [Open311] Remove update problem matching warning.Matthew Somerville2019-06-26-6/+0
| | | | Lots of false positives from other bodies too.
* [Open311] Allow description in email template.Matthew Somerville2019-06-20-4/+13
| | | | | By specifying a placeholder in an email template, it can be replaced by the description returned from the Open311 server.
* [Bexley] Close updates if Open311 marks report closed/fixed.Matthew Somerville2019-05-28-0/+5
|
* Fix some incorrect timezone code.Matthew Somerville2019-05-02-2/+8
| | | | | | | | | Times in the database should be stored in the application server's local timezone, by e.g. using `current_timestamp`, or by setting that timezone explicitly before storage (the database columns are all without timezone so any timezone info is silently ignored). Reports & updates fetched via Open311 and offline updates were being put into the TIME_ZONE setting if present, meaning they were stored incorrectly for future usage.
* [Open311] handle bad FixMyStreet id in updatesStruan Donald2019-04-09-0/+5
| | | | | If an update has a fixmystreet id in it check that it looks like an integer and if not issue a warning and skip the update.
* [open311] optionally use fixmystreet_id to match update to problemStruan Donald2019-03-12-2/+12
| | | | | | | | | | | If an update has a fixmystreet_id field then use the contents of that in preference to the external_id field to match an update to a problem. This handles the case where a report in a third party system passes through different types (eg inspection and defect), resulting in the external id changing. In this case it is sometimes possible to include the fixmystreet id in each type and hence use that to match things up at the fixmystreet side.
* [Open311] warn on staging if fail to match updatesStruan Donald2018-12-20-0/+4
| | | | | If we fail to match an update to a problem on the staging server then print a warning so we can diagnose issues.
* allow comment fetching to be limited by body nameStruan Donald2018-11-02-0/+5
| | | | | Allows creating scripts that fetch comments for a single body, e.g for batch updating or because they require special setup.
* do not reuse original open311 object in fetch comments loopStruan Donald2018-10-11-2/+2
| | | | | The //= meant that once `$open311` was populated we reused it each time which mean we were passing the original config in to each body.
* [Open311] More testing of GetServiceRequestUpdatesMatthew Somerville2018-10-09-13/+11
|
* [Oxfordshire] remove open311 hardcodingStruan Donald2018-10-01-4/+0
| | | | | we no longer need some of the hardcoded oxfordshire Open311 overrides so remove them
* [Open311] add customer reference from update to problemStruan Donald2018-10-01-0/+7
| | | | | If an Open311 update has a customer_reference property then add that to the metadata for the problem.
* [Open311] No update text on fixed state move.Matthew Somerville2018-08-06-2/+4
| | | | | | A move between fixed states (presumably from fixed-user to fixed-council) should not count as a state change for the purposes of generating comment text from templates.
* Map Open311 CLOSED status to closed state if extended statuses enabled.Dave Arter2018-06-21-3/+4
| | | | | | | | | | | | | | | | | | | | | The Open311 specification has two values for a report's status: - open: it has been reported. - closed: it has been resolved. FixMyStreet previously mapped 'closed' to 'fixed - council', but this has been causing issues with Open311 endpoints that want to mark a FMS report as closed but not fixed. The mySociety Open311 additions introduce extended statuses, some of which represent a 'closed' state e.g. duplicate, no_further_action, but there are times when a report should simply be closed without any indication why - for example, if open311-adapter is being used to integrate with a council system which has a closed state not represented by the extended statuses. Marking a report as 'closed' on a council system and displaying that as 'fixed' on the FixMyStreet front end is not an ideal situation. This commit changes the mapping of the Open311 'closed' status to the 'closed' FMS state when extended_statuses is enabled.
* [Oxfordshire] use localtime in open311 get update callStruan Donald2018-06-08-0/+2
| | | | | | | | | | As Oxfordshire uses local time and not UTC use that when calling the get update script. Also handle a date with a timezone being passed on the server side. And add some tests in for the oxfordshire open311 endpoint Fixes mysociety/fixmystreet-commercial#1062
* [Open311] Hide fetched update if no data to show.Matthew Somerville2018-04-27-2/+6
| | | | If no text, photo, or state change, hide the update from display.
* Don’t trigger response templates unless problem state changesDave Arter2018-04-23-15/+26
| | | | | | | Response templates won't be triggered unless the problem state or external status code is changed. Fixes #2075
* [Open311] Generally store update state.Matthew Somerville2018-04-10-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, an update's problem_state was set via an Open311 update if: * the update timestamp was equal or greater to the report's last update; * the new state was visible, and not equal to the report's current state; * the update wouldn't change the report from a fixed state to another fixed state; * (Oxfordshire) the update wouldn't change the report from any open state to Open. It would also set the report's state to match if the report was currently visible. This mostly worked, but could lead to issues if e.g. the report started life in a non-confirmed state (e.g. we pulled it in already fixed from an external source), as then the update did not record its state and the update display got confused as to the state history. However it did mean there wasn't confusion if a later update than the Open311 update was made on the site itself. This new code will set an update's problem_state if: * the new state is visible; * the update wouldn't change the report from a fixed state to another fixed state; * (Oxfordshire) the update wouldn't change the report from any open state to Open. It will also set the report's state to match if the report is currently visible, changing state, and the update timestamp is equal or greater to the report's last update. So when the report state changes is unchanged, all the conditions still apply, but the update's problem_state is set more often (it will be set regardless of whether the timestamps align, or whether the state matches the report's current state). This could theoretically lead to issues elsewhere, e.g. if an update is left on a report on FixMyStreet and then an Open311 update is pulled in later (but with an earlier timestamp) that changes the state, the report state will not be updated due to the later update being made, though the Open311 update will list the state change, and then the later update might say it changed it back (if it recorded the current state in its problem_state), even though it technically did not. I think this issue is less worrying than the current situation, which can state that a random update has fixed a report when it was the previous update that did, and there will always be such issues with multiple sources of truth for a report status. An alternative would be to allow the Open311 update to override.
* Allow same-time state change from Open311 updates.Matthew Somerville2018-04-06-1/+2
| | | | | | If we've pulled in a report and an update from an external source, both may have exactly the same timestamp, and we do want to record the problem_state in that case.
* Trigger response templates based on external_status_codeDave Arter2018-03-29-3/+10
|
* Fetch and store external_status_code in GetServiceRequestUpdatesDave Arter2018-03-28-0/+9
| | | | | | | If the Open311 endpoint provides the external_status_code field in servicerequestupdates.xml output, it’s stored in each comment’s extra field as well as the problem’s extra field. This will make it possible to trigger response templates based on this value.
* permit blank updates to be fetched over Open311Struan Donald2018-03-15-0/+4
| | | | | Add a per body configuration option to allow Open311 updates to contain only a status change, rather than emitting a warning when this happens.
* fetch new problems over open311Struan Donald2018-03-15-29/+3
| | | | | | | | | | This enables the display of existing reports from the back end on FMS if the body is configured to do this. Reports will not be created if they are missing an id, a lat or a long, if the lat/long is outside the area covered by the body, if there is already a report with a matching id, or if we can't parse out the request time.
* Use response template for Open311 updates without ‘description’ textDave Arter2017-12-04-4/+19
| | | | | | | If an Open311 service request update with an empty description field is received and there is a matching ResponseTemplate for the problem's category & state (and it's marked as auto-response) then the text from that ResponseTemplate will be used for the created update.
* Drop council_states and $visible_states.Matthew Somerville2017-08-29-1/+1
|
* Move FixMyStreet::DB to FixMyStreet::DB::Schema.Matthew Somerville2017-08-09-1/+1
| | | | Store a schema object on FixMyStreet::DB instead.
* [Oxfordshire] Open311 update, no open state switchMatthew Somerville2017-08-02-0/+3
|
* Skip incoming Open311 update if no ID or content.Matthew Somerville2016-08-10-0/+1
|
* Tidy up Open311 XML handling.Matthew Somerville2016-06-15-2/+1
| | | | | Parse the XML in such a way other parts of the code do not have to worry about single-value folding or the like.
* Skip fetched updates if they're out of date range.Matthew Somerville2016-04-26-2/+7
| | | | | Even when we ask for a specific range of dates, we sometimes get given more in the response.
* Only load images from disk when needed.Matthew Somerville2016-02-23-2/+1
| | | | Fixes #1337.
* Spot media_url in Open311 GetServiceRequestUpdate.Matthew Somerville2016-01-29-0/+14
| | | | Fixes #1315.
* Move from Moose to Moo in non-App code.Matthew Somerville2015-12-02-3/+3
| | | | And create default cobrand class without all of Moose.
* Reduce use of FixMyStreet::App.Matthew Somerville2015-12-02-6/+7
| | | | Command line scripts don't need a full blown app, just database.
* Simplify/consolidate body restriction db code.Matthew Somerville2015-08-19-7/+5
| | | | | | | Make dashboard work properly in two-tier councils, showing reports sent to both. Create an index on the array of the bodies_str column to speed up performance, and use that throughout the code replacing all LIKE scans. This also enables a simplifying tidy of the restriction code.
* Fix uncommon Open311 errors on processing updates.Hakim Cassimally2014-02-27-5/+7
| | | | | | | | | | | Fixes #677. The query to fetch the related alert sometimes: * retrieves no result, causing an error on $alert->id * retrieves multiple results, causing deprecation warnings (e.g. which may at some point become future errors in DBIC) This commit turns the resultset('DB::Alert')->find(...) into a search(...) and loops over the results, to suppress them.
* Don't update problem state from service request if currently hidden.Matthew Somerville2014-01-30-1/+3
|
* Remove *_local tz functions, set timezone on fetching original columns from ↵Matthew Somerville2013-02-14-1/+1
| | | | database.
* Remove all special body handling in order to move FMB to use bodies properly.Matthew Somerville2013-02-04-6/+4
|
* Merge remote branch 'origin/zurich'Matthew Somerville2013-02-04-15/+15
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bin/open311-populate-service-list bin/send-comments bin/update-all-reports conf/crontab.ugly db/schema.sql perllib/FixMyStreet/App/Controller/Admin.pm perllib/FixMyStreet/App/Controller/Report/New.pm perllib/FixMyStreet/App/Controller/Reports.pm perllib/FixMyStreet/Cobrand/Default.pm perllib/FixMyStreet/Cobrand/LichfieldDC.pm perllib/FixMyStreet/DB/Result/Open311conf.pm perllib/FixMyStreet/DB/Result/Problem.pm perllib/FixMyStreet/DB/ResultSet/Problem.pm perllib/FixMyStreet/SendReport.pm perllib/FixMyStreet/SendReport/Email.pm perllib/FixMyStreet/SendReport/Open311.pm perllib/Open311/GetServiceRequestUpdates.pm perllib/Open311/PopulateServiceList.pm t/app/controller/report_new.t t/app/controller/rss.t templates/web/bromley/report/display.html templates/web/default/admin/council_contacts.html templates/web/default/common_header_tags.html templates/web/default/dashboard/index.html templates/web/default/front/stats.html templates/web/default/report/_main.html templates/web/default/report/update-form.html templates/web/emptyhomes/index.html templates/web/emptyhomes/report/display.html templates/web/emptyhomes/report/new/councils_text_all.html templates/web/emptyhomes/reports/body.html templates/web/emptyhomes/reports/index.html templates/web/fixmystreet/report/new/fill_in_details_form.html templates/web/fixmystreet/report/update-form.html web/cobrands/fixmystreet/fixmystreet.js web/js/fixmystreet.js
| * Allow bodies to span multiple area IDs, and areas can be covered by more ↵Matthew Somerville2012-12-19-5/+6
| | | | | | | | than one body.
| * Rename a few more less important variables.Matthew Somerville2012-12-15-4/+4
| |
| * Rename council column to bodies_str, and all the related code.Matthew Somerville2012-12-15-10/+10
| |
| * Convert PopulateServiceList to use body IDs.Matthew Somerville2012-12-15-1/+0
| |
| * Rename 'open311conf' database table to 'body'.Matthew Somerville2012-12-15-1/+1
| |
* | tidy up hardcoded council (area) idsDave Whiteland2013-01-21-4/+5
| |
* | add Oxfordshire's non-standard endpoint for service request updatesDave Whiteland2013-01-21-0/+7
| |
* | Merge remote-tracking branch 'origin/master'Struan Donald2013-01-21-6/+8
|\ \