Closed (fixed)
Project:
Workflow-ng
Version:
5.x-2.1
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Sep 2008 at 16:02 UTC
Updated:
7 Mar 2009 at 16:00 UTC
Hi there,
I've got a problem with the field "States: State machine name" in views. I've added this option to my view as an additional field. When displaying the view some nodes appear twice or 3 times - according to the number of states the nodes are in. In my case this is a "wrong" behaviour. I only want to display the recent (last) state the nodes are in. How can I achieve this?
Thanks for any help, Bjoern
Comments
Comment #1
bjacob commentedOther question: if I can't fix the problem mentioned above is there a way to create a new field which displays the recent status in a view? I really need your help guys...
Comment #2
fagohm, I think that's due to different node revisions having different states. Try to filter to your latest revision.
Comment #3
bjacob commentedfago, thanks for your help. Sorry but right now I don't know how to filter my latest revision. As fa as I'm concerned I've never created a node revision. Can you tell me how to filter revisions?
Again another question: is there any reason for storing the old states? Why don't we delete the states in {node_state} and only keep the recent one?
Thanks again for your help.
Comment #4
fago>is there any reason for storing the old states
It's the way node revision work.
hm, I had a short look at it and I don't think it would list multiple revisions - it should list just the active one.
Do your result contain all the same state machine name? If yes, the problem is probably that there are multiple entries in the table where there shouldn't be multiple.. per revision and state machine should be just one entry.
Comment #5
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #6
bjacob commentedSorry for not answering for such a long time. The problem still exists. For example someone creates a new node. The state "pending" (cce_cclink0) is assigned automatically. Then the administrator of the page reviewes the node and clicks a workflow_ng link to assign a new state called "approved" (cce_cclink3). In my special case now a user is able to verify as owner of the node. I've created a module for this verification process. In the end (assumed everything is okay) a new state "verified" (cce_cclink4) is automatically assigned to the node. At that time I've got three entries in {node_state} regarding the node (one entry for each state).
A workaround would be to delete the old states "manually". I could add the delete query to my workflow actions to delete the previous states. Nevertheless, it would be great if someone could help me with the problem. Is there a built-in delete function which comes with workflow_ng?
EDIT: Maybe I'm using the function states_machine_set_state() wrong. As I said I'm using actions to set the new states. The PHP code looks like this:
I've read the documentation for the function:
Any ideas?
Comment #7
fagohm, these state machines created by cclink are used for remembering the links state. I think you should not rely on that for your state, but use a separate state machine for that. Then you don't run into troubles with "old" states, as you have only one state machine which is of interest for you. However, you have to write some lines of code to generate another state machine.
Anyway you could also use a CCK field for storing your state.
Comment #8
bjacob commentedThanks for your answer. I've created all the functions nearly 1.5 years ago. Drupal was totally new for me and maybe I didn't understand the whole idea of your awesome module. I think I started building my site with workflow_ng 5.1.x. Later you released 5.2.x and I think the custom state machines stuff was a new feature (or at least much better than in version 5.1)...
So you're saying instead of using content links I should create "real" state machines? Mmh, I don't know if this is possible at the recent state of my project. The whole website relies on the states (or content links) I've introduced. Coming up with a new state structure would result in completely rebuilding my site :( Do you think it'll be a problem to delete the old entries from the node_state table? If not I'll live with the wrong usage of content links and states and implement the above mentioned workaround.