Of Noderefs, Actions, Workflow, and Flags

I revisited some of the techniques I was using for a contracts management system for a speaker solicitation and event tracking tool. Once again, node references are creating a parent/child relationship, this time between solicitations for events and events themselves.

There's a distinct workflow for each type, but what happens to child might affect the parent somehow. For example, confirming a solicitation also moves the parent event into a confirmed state.

There are also flags involved to determine if an event is and emergency. One way an event can become an emergency is if the workflow state of a child solicitation changes from confirmed to canceled; the speaker backed out at the last minute.

Working on this made me grateful for APIs. Things like flag() and workflow_execute_transition(). Wonderful. This was also the first time I'd gotten to use D6's version of workflow and the improvements are tremendous.

Attached is the code at the heart of this. It is a custom action. Some of the values (workflow state IDs and CCK field names) are hard-coded for this specific project.

AttachmentSize
cv_relationships.module.txt3.59 KB