Circulation progress

by zinelibraryzac ()

I’ve had a bit of a breakthrough today on the circulation issue.

Our cirulation module needs to hook into the display of Item and Zine records. This was going to require some slightly tricky logic when it came to displaying the statuses of all Items when viewing a Zine record. We would have to build a table in the module’s hook_nodeapi() routines to output html. Ugly.

Before we even began developing the circulation module, we had embedded a view as a CCK field in Zine records which took that Zine’s node-id as an argument and output a list of associated Items. If we could figure out a way to get the circulation status in the Item record as a CCK field, we could simply include that in the embedded view and the status of each item would propogate through to the Zine record automatically.

I thought this would require creating a CCK field in our circulation module, but I’ve figured out a simpler (if less elegant) method using Computed Field. Computed Field allows us to use any PHP code we want to evaluate the value of a CCK field each time a node is accessed. Now we can put logic to lookup the circ status of an item into the Item record as a computed CCK field.