I have several log entries entered as “activities” that I want to change to “observations”. How do I change the log type?
Hey @graffte, unfortunately there isn’t a way to change the log type.
This question came up once before - just referencing here so it might be easier for others to find as well: Harvest category does not appear in edit log · Issue #392 · farmOS/farmOS · GitHub
@mstenta suggested the following:
If you have a lot of logs, and they are relatively simple, you may be able to export a CSV and then reimport it. But note that there are some very big limitations to this! Read the following links thoroughly: Export - farmOS.org Import - farmOS.org
The “best” solution (if you have a lot of logs that need to change) is to use the API. You can write a Python script that loads the logs you want, changes the type, and pushes them back to the server (which will create new logs).
Yea, this is a limitation in Drupal itself. The primary reason this limitation exists is because different log types may have different fields available on them. That’s not the case with Activities and Observations, but is with others (for example an Input log has “Input method”, “Materials”, etc - which would have no place to go if the log changed to an Activity, for example).
I can imagine developing a custom solution in farmOS itself where we provide an interstitial form that lets you make decisions about what to do with potentially orphaned data… this hasn’t been a frequent issue - and a workaround (although annoying) is available (using the API or export/import, as @paul121 mentioned).
You can write a Python script that loads the logs you want, changes the type, and pushes them back to the server (which will create new logs).
If you do this you also need to delete the original logs afterwards too… (if that wasn’t clear)
This would actually be a pretty simple Python script - I could see it being something worth generalizing and sharing with others… maybe we can create a little library of mini-scripts/tools like this for the community.
I would prefer those kinds of solutions over adding additional UI/complexity to farmOS itself. It reduces/distributes the maintenance…
And could provide a good set of examples for folks who are writing their own Python scripts but need more customization/complexity…
I know what Python is ( have even hacked a few lines into a Raspberry Pi.
If somebody with the knowhow could create a simple tool or two for this, it would be great.