The attached patch allows one to display the date a node entered a certain workflow state within a view. An example case for this would be a site that may have a "Completed" workflow state defined. In a particular view, they need to display the date a node was completed if it is in the "Completed" state.
I would entertain other suggestions on how to format the date, since the option view field is currently being used to define which workflow state to display the date. This patch defines some basic date formats as individual handlers... (short date, small, medium, large date).
Comments
Comment #1
viil commentedUnfortunately the patch shared by v1nce is outdated as it was developed for an older version of workflow.
I have the same problem: the node's current workflow state time stamp (which is found in the "workflow_node" table in the db as "stamp") is not accessible as a field in views.
Making the current workflow state's time stamp accessible to views could also help fix the issues of duplicates that so many others have been reporting, as the only workflow time stamps currently available to views are the ones from workflow revisions and scheduled workflows. See workflow: Previous time views field results in duplicate nodes, Adding workflow: previous comment to fields duplicates nodes in view results
Comment #2
viil commentedI've patched my workflow.views.inc file so that views can access the stamp field data in the workflow_node table to get the time stamp of the current workflow state.
after the following lines of code:
I added the following lines of code:
Comment #3
zroger commentedHere's a patch that adds workflow_node.stamp in a similar manner as workflow_node_history.stamp, like viil did in #2.
Comment #4
jvandyk commentedThe patch in #3 was straightforward and worked well in the views I created and tested. Committed. Will appear in 6.x-1.5.
Comment #6
telegraph commentedI'm trying to build on this patch a little further. I would need the workflow node stamp available as an argument in views. Inspiring myself from the patch above I came up with this:
So far, so good, the argument works, but the record count that is supposed to go with the functionality only ever returns '1' ( as opposed to the amount of entries it finds with regards to the argument).
Would someone have an idea of how I can get it to return the proper count?
Cheers,
Comment #7
telegraph commentedYay, I got it! I even created a patch for it :). #6 is actually the wrong place to add code, so please disregard. The solution is to create a new entry in that file, which is:
This patch lets you pass an argument for the workflow transition date (stamp) in the form of YYYYMM.
I've never submitted a patch before, so here goes.
Comment #8
telegraph commentedComment #9
johnvComment #10
johnvThis issue was already fixed.
@telegraph, I opened a follow-up issue #2147471: Add views argument for "Workflow: current time" with your patch.