Posted by tsvenson on April 12, 2009 at 12:34am
Jump to:
| Project: | Workflow |
| Version: | 6.x-1.1 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
I have a workflow with three stages In Draft, In Review and Live. The author can only move it from draft to review and from live back to draft.
The bug is that when an author creates a new node both In Draft and Live are listed and Live is preselected. In the from/to section, in the workflow configuration, I have only ticked that author can move from creation to In Draft. Thus if they, which most of them most likely will, submit the node without changing this it will be saved with creation as stage and thus the workflow will not work at all for these nodes.
Comments
#1
I have managed to find a workaround for this by using and Action/Trigger that moves it to In Draft when a new node is created.
#2
OK, I backtrack on the above comment. That workaround didn't fix the problem, it just created another.
I am using the Workflow Fields module with workflow. I had a major problem that authors could not create their content profile. It works when Workflow Fields is disabled, but not when it is enabled. It all comes down to that Workflow for some reason think that new nodes are in the Live state, which is what Workflow Fields filters on. See #444112: User cant create their Content Profile for more info on what problems that created for me.
Like in #327144: workflow-state tokens are reversed the author can only move a new node into one state, In Draft, so I tried that patch but it didn't change anything.
I am also using Content Profile with this content type. The Content Admin has no problem going to the users page and create the node for them. When the CA saves it the Action/Trigger kicks in and makes sure it is In Draft. From there everything works as it should and the author (user) can edit their profile and move to In Review and from Live back to In Draft as the workflow stipulates.
I haven't found any settings that let me define what initial state a new node shall have before it is saved for the first time. I would really appreciate some help here to find out what it is that makes Workflow to set it to Live in Creation.
#3
OK, faffing around in the db tables seems to fix all my problems today.
In workflow_node I had a row with the following data:
nid=0, sid=4, uid=1, stamp=1239228241
I simply changed sid to 2 and eureka the author could all of a sudden create their nodes.
I have no idea how a row for node 0 ended up here, I certainly didn't add it. For some reason it makes the workflow think that new nodes shall be in stage 4...
Is it supposed to be there? I have deleted it and everything seems to work fine without it. If it is supposed to be there, please let me know and I will put it back...
#4
I just had the same problem - nid=0 was in the database and meant that completely the wrong workflow was being displayed on a content type (I have many workflows). Deleting that row fixed the issue.
Great spot tsvenson!
#5
Since this request is over a year old, I'm going to assume a solution was found or you've moved on. If not, please get updated to the latest versions of all modules and make a request for it against Drupal 7 and I'll be glad to take a look at it.
#6
I was having the same problem with version 7.x, and solved it using the weight property in workflow_states table.
The initial state must have the lower weight of them all.
You can find what the initial state of a new node will be by node_loading an existing node of the same type and using it in
workflow_field_choices($node)) like this:
<?php$node = node_load($nid); // $nid of the node of the same type
kpr(workflow_field_choices($node)); // must have devel module enabled
?>