Setting default values in Animal Assetr

Hi, just installed this on my pi and trying to get to grips with it

ive got one breed of Sheep ( Boreray) ,who all have ear tags
How can i set a default value ( or remove the 'required ’ bit in each of the input fields ?
Ive had a play with ~ line 248 in profiles/farm/modules/farm/farm_livestock/farm_livestock.module
but that didn’t do anything

1 Like

If you have admin access, you can enable the Field UI module and change default values and required field settings via the Drupal admin UI. https://www.drupal.org/docs/7/core/modules/field-ui

I’m tempted to caution against this though, unless you have a very good reason, and know how to maintain these overrides alongside updates to farmOS. Could you describe a bit more why you want to do this? What are you trying to accomplish from a workflow perspective? Maybe I can help by suggesting alternatives. :slight_smile:

The “proper” way to do this would be to write a module that alters these things, without touching/hacking the core farmOS code. This is one of the golden rules of farmOS (and Drupal): “don’t hack core” - don’t modify the farmOS code itself, unless you are proposing an upstream change. Otherwise you are essentially managing a fork of the software, and any changes you make need to be recreated every time you upgrade to a new version. A module, on the other hand, can be managed as it’s own code repository that simply “hooks into” certain parts of the farmOS/Drupal code and makes alterations.

to make it more straightforward entering 84 details of 84 sheep , to get started

1 Like

Maybe the CSV importer would help? Import - farmOS.org

had a look at that - no indication what defaults it may/may not accept or error checking with the input so i imagined having several goes at getting all the fields correctly formatted for it to accept anything
And then there is still adding new stock as we get it

1 Like

If you are interested in coding, you might want to consider making a “quick form” in a custom module for your specific data entry needs. Then you can control exactly what information you are collecting, and exactly where it’s going.

There are a few examples in farmOS you can look at. I would recommend enabling the “Farm Quick” module first, and clicking the “Quick” tab on the dashboard to get a sense for what it might look like. Then you can use the existing quick forms as examples to work on developing your own.