Inventory field
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
This is a CCK field that lets you take inventory of a list of items. At node creation time, each of those items has a select box with numbers letting you say how many of that item you have, or a textfield to specify an arbitrary value.
Note: Changes in 2.x-dev version of this module change the internal database representation for table inventory_fields, so check the "Release Notes" before updating!
The item list source can be specified as:
- plain text using the format "itemkey|item name"
- php code to be executed and should return a hash of values
- sql query
- nodes from specific content types
Database representation
The above field is stored in the db like this:
mysql> select * from inventory_items;
+-----+-----+--------------------+----------+-------+
| nid | vid | fieldset | itemkey | count |
+-----+-----+--------------------+----------+-------+
| 37 | 37 | field_article_piro | CARR001 | 11 |
| 37 | 37 | field_article_piro | CARR007 | 23 |
| 37 | 37 | field_article_piro | CARRVM07 | 5 |
+-----+-----+--------------------+----------+-------+
Development Plans
I've been thinking a while on how to improve this module for a better CCK integration (e.g: use the multiple values feature) and upgrading to Drupal 6.
The desireable behaviour for a better inventory field would be something like CCK's "Add more"+AHAH forms with autocompletion textfields (like nodereference's), but first attempts to find out a good solution for this meant a big rewrite of the module implementation.
Another crazy idea would be switching to a new "multiple value" field group instead. The problem is that I didn't see a way to do this in a propper way in CCK.
(See http://drupal.org/node/119102 for more discussion about this last idea)
Feel free to send me any suggestions, please ;)