Reserving NIDs for Inventory Tracking System

Vendetta501 - August 11, 2009 - 02:46

I am creating an inventory tracking system, where people will be labeling pieces of inventory with ID numbers. For simplicity, I think it will be best to make the ID number written on the physical item the same as its NID in Drupal.

My idea: When someone goes to file a batch of items, they would be told the highest NID currently in use. As they categorize the inventory, they count up from this number, writing each new item's NID both on the item itself and in the proper row in the .csv. Then, they would import it into the database (using another module).

Problem: What if, while they are categorizing items, someone else makes a new node? Now everything is off by one, and it all has to be redone.

Solution 1: Enforce a general lock on all node creation while categorization is in process.
Solution 2: Create a bunch of empty nodes, so new nodes created by other users won't conflict. However, if "a bunch" = 20, and only 10 new pieces of inventory are added, there are now 10 fake node entries in the db.

Any other ideas?

I would consider using the

nevets - August 11, 2009 - 02:54

I would consider using the Type-local nids module.

CCK

Vendetta501 - August 11, 2009 - 03:18

or, to follow the suggestion on that node's project page, I could "re implement it using CCK." But wouldn't that add another layer of complexity and ID numbers to keep track of?

From the end users point of

nevets - August 11, 2009 - 04:03

From the end users point of view since they really do not care about nids, only an unique serial number. This way you can have a content type that once created displays the serial number to the user which they can use to mark the inventory. It's also easier for you since you don't need to try and play games with nids. So externally people only see the serial number and Drupal uses nids in it's standard fashion.

pathauto

Vendetta501 - August 12, 2009 - 17:24

Ok, perhaps I'll try this.

This may be RTFM, but is there a way I can set pathauto to make paths for inventory items like

inventory/unique-serial-number

similar to

node/node-number

to make it easier for users to access item nodes?

From the project page

nevets - August 12, 2009 - 18:01

lnids are exposed via the Token module. When used in conjunction with the Pathauto module, this enables you to have node paths where each node type has its own serial number-space (as opposed to all nodes sharing the global nid serial number-space).

 
 

Drupal is a registered trademark of Dries Buytaert.