aboutsummaryrefslogtreecommitdiffstats
path: root/t/open311
Commit message (Collapse)AuthorAgeLines
* Don’t crash when fetching Open311 requests with missing descriptionDave Arter2018-08-17-0/+21
|
* [Open311] No update text on fixed state move.Matthew Somerville2018-08-06-0/+20
| | | | | | 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-1/+13
| | | | | | | | | | | | | | | | | | | | | 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/+37
| | | | | | | | | | 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
* [Bromley] Add asset/PROW ID meta to attributes.Matthew Somerville2018-06-04-63/+9
|
* [Open311] Hide fetched update if no data to show.Matthew Somerville2018-04-27-0/+2
| | | | If no text, photo, or state change, hide the update from display.
* Use explicit ordering for test queryDave Arter2018-04-23-1/+1
| | | | This hopefully works around some odd test failures on Travis.
* Don’t trigger response templates unless problem state changesDave Arter2018-04-23-0/+12
| | | | | | | Response templates won't be triggered unless the problem state or external status code is changed. Fixes #2075
* Merge branch 'open311-update-problem-state'Matthew Somerville2018-04-11-1/+1
|\
| * [Open311] Generally store update state.Matthew Somerville2018-04-10-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | [Open311] fetch_all option for open311 problem fetchingStruan Donald2018-04-11-0/+41
|/ | | | | | | | | If a body has a `fetch_all_reports` setting in the extra metadata then all reports are fetched over Open311 and processed regardless of age. This is useful for bodies where the API endpoint always returns all the reports as it suppresses the error messages you would otherwise get about reports with invalid dates.
* Correctly assign problem categories in GetServiceRequestsDave Arter2018-04-04-2/+3
| | | | | | | | FMS uses the Contact->email field for the Open311 service code, and the Contact->category field is the user-friendly service name. The wrong value was being compared previously, resulting in all fetched problems being assigned to the 'Other' category.
* Default to last two hours in GetServiceRequestsDave Arter2018-04-04-5/+21
| | | | Also adds script for fetching the last 24hrs of reports
* test that options pass from body to fetching problemsStruan Donald2018-03-29-0/+30
|
* optionally convert from EPSG:27700 to WGS84 on report importStruan Donald2018-03-29-1/+39
| | | | | | | When pulling reports in over Open311 it's sometimes useful to be able to accept reports with Easting/Northing rather than latitude/longitude. This adds an option to GetServiceRequests to convert them as they come in.
* Trigger response templates based on external_status_codeDave Arter2018-03-29-0/+41
|
* Fetch and store external_status_code in GetServiceRequestUpdatesDave Arter2018-03-28-0/+48
| | | | | | | 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.
* Store server_set automated, but ignore for input.Matthew Somerville2018-03-21-90/+0
| | | | | We do need to store them, so that the sending knows which fields are being requested, but we do not want them output to the client at all.
* permit blank updates to be fetched over Open311Struan Donald2018-03-15-0/+48
| | | | | Add a per body configuration option to allow Open311 updates to contain only a status change, rather than emitting a warning when this happens.
* Deal with 'automated' Open311 service attributes.Struan Donald2018-03-15-0/+90
| | | | | | This is part of the integration with our open311-adapter. The automated property indicates that it's an expected value but either it's going to be set by the server, or appear as a hidden field.
* fetch new problems over open311Struan Donald2018-03-15-0/+301
| | | | | | | | | | 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.
* Store group on Contacts in Open311 PopulateServiceListDave Arter2017-12-05-0/+9
|
* Use response template for Open311 updates without ‘description’ textDave Arter2017-12-04-3/+27
| | | | | | | 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.
* [Oxfordshire] Open311 update, no open state switchMatthew Somerville2017-08-02-67/+105
|
* Add inactive state to categories.Matthew Somerville2017-07-14-27/+14
| | | | | A new 'state' column replaces confirmed and deleted, allowing categories to be unconfirmed, confirmed, deleted or inactive.
* Run each test file in a transaction.Matthew Somerville2017-06-20-10/+3
| | | | This means that the tests can be run in parallel.
* Remove need for sv_SE in tests.Matthew Somerville2017-05-25-3/+3
|
* Remove Open311 endpoint to separate repo.Matthew Somerville2016-08-23-1327/+0
|
* Shrink test sample photo.Matthew Somerville2016-08-16-1/+1
|
* Use valid orientation flag for test imageDave Arter2016-06-27-1/+1
| | | | | | jhead 3.00 considers 0 an invalid value for EXIF orientation and will replace it with 1 when run with the -autorot flag. This was causing a test failure as the SHA hash of the sample image was being changed.
* Tidy up Open311 XML handling.Matthew Somerville2016-06-15-14/+3
| | | | | 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-6/+7
| | | | | Even when we ask for a specific range of dates, we sometimes get given more in the response.
* Add PNG image support.Matthew Somerville2016-04-08-1/+1
| | | | | | | Store image type along with hash in photo column, and use that when outputting images / generating URLs. Make sure all public photo URL generation goes through appropriate functions, and change temp URLs so the filename can be output directly from the list.
* Updates to cpanfile and code for perl 5.20/5.22.Matthew Somerville2016-03-23-17/+26
| | | | | | | | | | | | | | | | | | | | The following modules had bugs that have been fixed for working in recent perls: * List::MoreUtils * Guard * PadWalker * aliased * URI * Convert::NLS_DATE_FORMAT The CGI module was removed from core in 5.20, so include it in the snapshot (I don't think it's actually used, but is a dependency). "{" needs to be escaped in regular expressions, and ~~ should not be used. Fix some tests that expect e.g. a certain hash ordering, to use sorted output or better comparisons.
* Switch final few JSON uses to JSON::MaybeXS.Matthew Somerville2016-02-09-13/+8
|
* Spot media_url in Open311 GetServiceRequestUpdate.Matthew Somerville2016-01-29-0/+27
| | | | Fixes #1315.
* Reduce use of FixMyStreet::App.Matthew Somerville2015-12-02-43/+44
| | | | Command line scripts don't need a full blown app, just database.
* Simplify/consolidate body restriction db code.Matthew Somerville2015-08-19-16/+14
| | | | | | | 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.
* Remove ms_current_timestamp() override function.Matthew Somerville2015-08-13-9/+9
| | | | | This override is not used anywhere, it dates from a very old long-gone test script, and causes issues with database query planning.
* Add Extra role to ease use of {extra} field.Hakim Cassimally2015-03-20-10/+11
| | | | | | | | | Historically, the extra field has been used in two different ways by different cobrands, both as a list (e.g. Open311 category fields) and a hash (e.g. the Zurich cobrand). This commit consolidates usage, adding an API to make use of the field easier and always returning a hash for the code to use. Fixes #1018.
* [fixmystreet.com] Remove special NI code.Matthew Somerville2015-03-16-0/+1
| | | | | This is now handled by normal bodies in the admin. In order to remove references in send_reports, tidy up (unused) EmptyHomes code a bit.
* Remove need for cron-wrapper with existing scriptsMatthew Somerville2015-01-19-8/+0
| | | | | Call the necessary boilerplate in each script so you can call them directly. Remove boilerplate from files that don't need it.
* [Warwickshire] Integration bits during/after visitHakim Cassimally2014-10-16-184/+220
| | | | | | | - Tweaks required to get things working in WCC environment - update Open311 to onsite changes - updated Open311 parameters after WCC's Bentley and County Highways workshop. - ... including ce_cpr_id
* Open311: FMS <-> Open311 Endpoint End to end testsHakim Cassimally2014-10-16-9/+147
| | | | | Uses LWP::Protocol::PSGI to avoid having to spawn external processes in order to test these end to end.
* Open311 Warwick (Exor) IntegrationHakim Cassimally2014-10-16-8/+330
| | | | | | | | | | | | | | | | | | | | | | | ::Integration::Warwick subclasses ::Integration::Exor refactor request_class and new_request Exor service Warwickshire updates retrieval, with datetimes stubbing out of Oracle constants, for local testing We also edit FMS's core PopulateServiceList routine to hide system fields from FMS: Bromley/Warwickshire send metadata in their services/FOO.xml advising that you can pass, e.g. attributes[easting]. FMS by default shows all of these to the user to fill in, however we don't *want* the user to supply these, rather they are added by the cobrand. Bromley had an exception for this (keyed by $body->areas->id). We write this more generally for Warwickshire too, keying instead by $body->name (as this is far less likely to be overridden for installs using global or custom Mapit's)
* Open311 Role for accepting default config fileHakim Cassimally2014-10-16-0/+24
| | | | | | | | See also MooX::ConfigFromFile, but that's underdocumented and seems overengineered -- may be worth implementing if requirements become more complex however. (See also Config::Any, which is well worth doing in future, using YAML only reflects current usage in FMS though.)
* Open311 Endpoint mySociety extensions roleHakim Cassimally2014-10-16-3/+194
| | | | | | | | | | | | | | * Get Service Request Updates This requires a new object ::Service::Request::Update, which of course is not part of standard spec. So, in order to make the core not too contaminated by : * the endpoint should instantiate ::Service::Request::mySociety objects which know about updates * have added a learn_additional_types callback from Schema to Endpoint, so that core doesn't need to know about /open311/service_request_update * (but ::Spark knows about the exception for updates... meh, but is 1-line)
* Open311 EndpointHakim Cassimally2014-10-16-0/+623
| | | | | | | | | | | | | | | | | | | | | Subsystems include * ::Spark encoding conventions for xml/json * ::Schema using Rx to validate form of inputs and outputs, including validation for, e.g., dates and CSV as part of Open311 Handles following paths: * Open311 attributes for Service Definition http://wiki.open311.org/GeoReport_v2#GET_Service_Definition * POST service request * GET Service Requests * GET Service Request Objects: * ::Service * ::Service::Request
* Update old-style open311 script to use bodies.Matthew Somerville2014-04-07-13/+16
| | | | Add some comments to the top of the open311 bin scripts.
* Add test for de47a7f.Matthew Somerville2014-03-12-15/+63
| | | | | | This tests that the default string used by the old-style Open311 update code if there is no incoming string and the report is marked fixed, is translated.