Download & Extend

Small error if updating a node with no valid workflow states

Project:Workflow
Version:6.x-1.1
Component:User interface
Category:bug report
Priority:minor
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

It exposes an underlying problem at my end, but the symptom required code debugging to discover.

Situation:
- I'd created a complex workflow, including permissions restrictions.
- I was logged in as NOT user #1, but had most admin rights
- we added a new content type (FAQ) and had it participate in the workflow
- BUT we had no per-node configs filled in for that new node type

-> The node-edit workflow edit form still appears, but with nothing to select.
OK, that's not a big problem.
... it seems the workflow TAB still displays all options. Not sure if that's intended.

But, ignoring that, and changing that new nodes published status (promote to front page) attempted to trigger a workflow transition.

function workflow_transition($node, $sid)

and the UI displayed:
warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in /Shared Items/Server/Websites/_Non_virtual_host/familiesDev/sites/all/modules/workflow/workflow.module on line 270.

I decoded that to mean
$sid was blank
and there was no valid state for it to move in (or out?) of.

This doesn't always reproduce the problem, so I'm thinking the issue is somewhat self-healing. But it would be nice if a sanity check gave a more helpful message - "There are no valid workflow states for this content type"

There may be something else that is allowing my nodes to be created with NULL workflow, but I think it's just an awkward set of conditions that throws the error. Perhaps a check to announce "This content type participates in the *** workflow, but has no legal workflow state enabled."
It's just about making the UI a bit friendlier and bullet-proof I guess.

Comments

#1

I am experiencing the same problem, error on 270, and no states to change the form to. This is a bit of a problem for me, especially the no states part.

#2

the fix is to review the valid states and make them sensible.
The bug report is about the unhelpful error message when this problem exists.

Try adding the valid states to that problem content type.

#3

Would this be of any help? Workflow post-install.

#4

mmm. maybe.
Should be a small issue to the module itself, seems like an odd thing to be downloading a module for.

#5

I am not understanding this too much. I have a workflow with five states, and 3 roles that are using it.

(creation)
queue
draft
review
approved

I have one role that can move the item from draft to review, and another person can move it back if it needed. Once the item is placed back in draft, it doesn't automatically select review when saved, and gives the error. The proper function would be for it to automatically place the item in review mode, as that is the only option other than leaving it in it's current state, which is not valid.

How can I force it to do that and not give me the error about line 270? I have searched but haven't come up with an answer to this one, is it a duplicate?

Thanks,

Pat

#6

Aha, this http://drupal.org/node/369303 at least makes my situation workable.

#7

@RdeBoer, Thanks man.

#8

I got this error too and searching for its cause led me here.
Upon reading that the cause of the problem was the blank $sid value, I re-focused my efforts.
There was no $sid value because workflow options (sid's) were not rendered as radio buttons nor hidden field in the node edit form.

I did a few more searches and found this gem:
http://drupal.org/node/364608

It involves patching the workflow.module file though.
Until the fix is rolled out with official releases, you'll need to check the workflow_form_alter function everytime you update Workflow.

#9

Status:active» closed (won't fix)

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.