< 052026-08-06⋎07 >

Topic for #farmOS is: farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Forum: farmOS.discourse.groupSet by mstenta on 2021-06-15 at 12:52
11:24*MiriamNugent[m] has joined
11:24MiriamNugent[m]Hi mstenta Greg I'm working on a bug that Greg found when using quick forms with farm multitenant installed. When using the built-in Planting quick form we get a validation error when saving the log, because the associated asset isn't assigned to a farm.
11:24MiriamNugent[m]To solve this, I'm thinking we could add a quick form submodule to multitenant with a QuickForm plugin that extends the built-in planting quick form and adds a mandatory farm field that can be saved to the asset. This works, although phpstan complains because Planting is defined as @internal
11:24MiriamNugent[m]What do you think? Is this the right approach or should I just document in the README how to create a multitenant quick form?
11:28mstenta[m]Hmm two thoughts:
11:29mstenta[m]1. Maybe core Planting quick form should have a conditionally added field for specifying what farm the plant asset is in, if the farm organization module is installed
11:30mstenta[m]We should think about the other core quick forms too in the same regard... eg: the Birth quick form
11:30mstenta[m]In general though, core should not require a farm
11:30mstenta[m]So that leads to...
11:32mstenta[m]2. Does multitentant explicitly or implicitly require the farm to be populated on all assets? Is the validation constraint specific to nultitenant?
11:32mstenta[m]s/nultitenant/multitenant/
11:34MiriamNugent[m]multitenant alters the asset form to make the farm mandatory for users that don't have administer farm_multitenant permission. The validation constraint is specific to multitenant
11:44mstenta[m]Got it
11:46mstenta[m]So yea best solution is probably to add a field to the core form and then make that required via multitenant too in form alter
11:47mstenta[m]Although it does lead to a bigger question about how tenable this is more broadly
11:47mstenta[m]Multitenant can add form alters for core quick forms
11:47mstenta[m]But not contrib ones
11:48mstenta[m]But maybe that will always be a known limitation, and those contrib would be responsible for adding compatibility with multitenqnt
11:48mstenta[m]Can't think of any specifically... just thinking ahead...
11:49mstenta[m]mstenta[m]: I'm hoping to get features organized for farmOS 4.1.0... maybe this could be included
11:49MiriamNugent[m]Maybe multitenant could detect contrib forms that don't have a farm field, and add a warning saying the form is not compatible with multitenant
11:50mstenta[m]Hmm maybe... might be more complicated than that...
11:51mstenta[m]eg: the Birth quick form... that also doesn't have a farm field. It should probably automatically assign child assets to the same farm as the mother
11:51mstenta[m]So it will never have a farm field
11:51mstenta[m]But yea, maybe we don't need to worry about all hypothetical contrib forms
11:52mstenta[m]We should ensure it works with core forms though
11:52mstenta[m]Planting and Birth may be the only ones that create assets... can't remember if others do... 🤔
11:53mstenta[m]Most others only create logs
11:53MiriamNugent[m]I checked the others. It's just planting and birth that are affected
11:53mstenta[m]OK great
11:54mstenta[m]Q: do you have budget to work on core PRs for those?
11:54mstenta[m]If not, you could just temporarily form alter them
11:54mstenta[m](of course, that is tech debt that needs to be undone when we do make the core changes)
11:56MiriamNugent[m]I will have to check with Greg about budget.
11:56MiriamNugent[m]I looked at doing a form alter, but the form submission is tricky because I would need to add the farm to the asset created by the core submission handler
11:57MiriamNugent[m]I don't think I would have access to the asset's entity id
11:58mstenta[m]Oh I see
11:58MiriamNugent[m]that's why I extended the form instead
12:00mstenta[m]Maybe we need some mechanism of tracking entities that are created during quick form submit, so that form alter can add another submit that runs after it and pull those from form state...
12:00mstenta[m](Actually... maybe we do? 🤔)
12:01mstenta[m]Ah no... doesn't look like we do
12:01mstenta[m]github.com/farmOS/farmOS/blob/4.x/module
12:02mstenta[m]That is another nice little PR we could consider
12:02mstenta[m]But lower priority if we're just going to add farm field handling to core anyway
14:08barkerd427[m]mstenta[m]: Thank you. I will work on this for farmos.py. It's quite necessary with AI writing code but human reviewers.
14:43mstenta[m]Oops sorry barkerd427 - that was actually out of context.
14:44mstenta[m]I sent a message to the wrong room 😅
14:44mstenta[m]Wait... no I didn't haha - I thought that chat with Miriam Nugent was in a different room. I was on my phone at the time.
14:45mstenta[m]barkerd427: I see now you were referring to the "stacked PRs" message from earlier.
14:45mstenta[m]Disregard my confusions... 😅
15:54symbioquine[m]The weekly farmOS development call is on in about 6 minutes - all are welcome! meet.jit.si/farmos-dev
15:57barkerd427[m]I'll be 30 minutes late.

< 052026-08-06⋏07 >