< 042020-10-05⋎06 >

farmOS (farmos.org) is a free and open source, web-based farm management system. User guide: farmos.org/guide/ - Feature requests and bug reports: github.com/farmOS/farmOS/issuesSet by ChanServ on 2018-08-16 at 14:32
08:46*farmBOT has quit (Ping timeout: 240 seconds)
08:46*farmBOT has joined
20:02skalakm[m]I'm reading the message you left. I think you're giving me too much credit for knowing what's going on. As I understand it, my first step should be running a php script (eg with drush php-script) that calls that function with the appropriate inputs. I'm not sure what step 2 is. Does that function itself do the grouping? What do I do with the log that's returned? I've used the feeds module to import some logs, but I
20:02skalakm[m]don't see an importer for this type of log.
20:05mstenta[m]Hi skalakm - haha looking back I may have misread your question too.
20:06mstenta[m]What exactly are you trying to do? I'll see if I can suggest something more specific...
20:07skalakm[m]For example, I have 3 asset types (apples, cantaloupes, and honey dew melons) that I have imported. I would like to assign them all them all to the group "fruit".
20:08mstenta[m]Ok!
20:09mstenta[m]So first, create the group named "Fruit"
20:10skalakm[m]Ok, that's done.
20:10mstenta[m]Then, if you have all the asset IDs...
20:11mstenta[m](assuming the first three are IDs: 1, 2, 3 - and the "Fruit" group is 4)...
20:12*sent a long message: < matrix.org/_matrix/media/r0/download/mat >
20:12mstenta[m]oops - hit enter too soon :-)
20:14*sent a long message: < matrix.org/_matrix/media/r0/download/mat >
20:15mstenta[m]That PHP code will create a log - that assigns the plantings to the group
20:15mstenta[m]Are you hoping to perform this assignment DURING Feeds import?
20:16mstenta[m]It might make sense to do it afterwards
20:16mstenta[m]So all the assets are in the system
20:17mstenta[m](Worth noting, this is a very similar problem to assigning "Location" during Feeds import - which I believe @megandalster made his own solution for here: github.com/farmOS/farmOS/issues/199#issu)
20:21skalakm[m]Afterwards is fine. What do I do with the log? (I'm still looking at Allen's code to figure it out.)
20:22mstenta[m]You don't need to do anything with the log - it's basically just a record in the system that says "These assets are in this group now"
20:23mstenta[m]That's how farmOS determines what groups an asset is in - by looking for those logs
20:23mstenta[m]Same for location
20:23mstenta[m]So that: over time you can have a history of an assets movements (and group membership changes) over time
20:24mstenta[m]That probably isn't needed for your use-case (Grouping plantings), but is needed for things like animals moving from one herd to another
20:25*nickredmark[m] has quit (Ping timeout: 244 seconds)
20:28*jgaehring[m]1 has quit (Ping timeout: 244 seconds)
20:28*blm5303[m] has quit (Ping timeout: 244 seconds)
20:28skalakm[m]You never know when something will stop being a fruit... I'll need to try out what you said, but while I've got you here, is there a similar way to assign harvest logs to users?
20:28*jgaehring[m]1 has joined
20:28skalakm[m](and this might be a stupid question, is that snippet you gave me the entire file? do I need import statements or something? My php is a work in progress)
20:29*blm5303[m] has joined
20:29*nickredmark[m] has joined
20:29mstenta[m]> You never know when something will stop being a fruit...
20:29mstenta[m]Haha WHAT IS a fruit, really? ;-)
20:31mstenta[m]> is there a similar way to assign harvest logs to users?
20:31mstenta[m]We don't have a general purpose "helper function" for assigning a log to a user, but all the logic can be found here:
20:31mstenta[m]github.com/farmOS/farmOS/blob/92f854b9be
20:31mstenta[m]that is the code that runs when you click a checkbox next to a Log in farmOS, and click the "Assign" button
20:31mstenta[m]> is that snippet you gave me the entire file? do I need import statements or something?
20:31mstenta[m]that was just a snippet - where you put it depends on where you need it :-)
20:32mstenta[m]but for example... that could be put in a simple `test.php` file in the webroot, and run via `drush php-script test.php`
20:32mstenta[m]that's a quick and dirty way to run code
20:33mstenta[m]or... it could make sense to write something more general in a module... just depends on what you need
20:33mstenta[m]are you working with custom modules at all yet?
20:35skalakm[m]No, I'm still at quick and dirty. I'll give it a try that way and see what happens. Thank again for all your help.
20:35mstenta[m]Thumbs up!

< 042020-10-05⋏06 >