Problem/Motivation

Currently the "Movement" fields on logs have three sub-fields: "Movement to", "Movement from", and "Movement geometry". "Movement to".

The "Movement to" field is what is used for determining asset location in the system, along with the "Geometry" field for specifying geometries more specifically.

The "Movement from" field, on the other hand, was added early on in farmOS simply as a way to keep track of where the assets were previously. Of course, this isn't really necessary, because you can look back at their previous movement log to get that information. But, my thought was that it would be good to have a "From" field just in case something went wonky with the logs, and you ended up with them being out of order, or an intermediary movement was deleted. At least the "From" field would provide some accountability that you could look at to figure out what happened.

As farmOS matures, and movements are used in more advanced ways (ie: the Grazing module), I'm rethinking that decision. We are finding instances where the logic for auto-populating the "From" field is not working properly, so it ends up with incorrect references.

Proposed resolution

I am proposing that we scrap the "From" field entirely, along with all the extra code that is there to auto-populate it.

Instead, I will add a bit of code that looks for a previous movement log and displays that as the "From" area. So for practical purposes, users won't notice any change. It will still display the "From" information, but it will no longer be a field that can be edited or changed.

This will solve the current issues with the "From" auto-population logic and simplify the code all at once.

If, in the future, we decide that the "From" field is necessary, it can be restored and populated with the previous log information. I don't foresee that being necessary, though.

Remaining tasks

- Remove field_farm_move_from field base and instance config.
- Remove field_farm_move_from from Views.
- Take out the code for auto-populating the "from" field.
- Add an update hook to delete the field data from the database.
- Update older update hooks to also remove references to the "from" field.
- Look up and display "from" areas when displaying "Movement to" field on movement logs.
- Update farmOS.org documentation (in beta17 branch - to be published on release)

User interface changes

The "Movement from" field will no longer be available when EDITING a log.

When VIEWING a log, there will be a minor change to the way the asset's previous locations are displayed.

API changes

None. Perhaps we can provide the "from" information via the API if needed. This can be a followup issue.

Data model changes

The "Movement from" field will be removed.

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Issue summary: View changes
Status: Active » Needs work

Started working on this in branch "2941675" on GitHub: https://github.com/farmOS/farmOS/tree/2941675

m.stenta’s picture

Issue summary: View changes

  • m.stenta committed 6f5544f on 7.x-1.x
    Issue #2941675: Dynamically populate "Movement from" field (remove...
m.stenta’s picture

Issue summary: View changes
m.stenta’s picture

Status: Needs work » Fixed

Done!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.