this will probably be difficult to reproduce without the specific workflow permissions configuration used where this bug manifests. but i think i can explain it clearly enough anyway.

the logic for changing a workflow state to the 'next' state (which is what this action does) relies on the order of elements returned by workflow_field_choices($node)

Say you have 3 workflow states: one, two, three.

You want to "promote" the state of a node from "two" to "three".

The code in action_workflow_execute_transition() loops through the array returned by workflow_field_choices($node) and when it matches the current state, it then sets the new state to the next element in the array.

However, in my test case, the current workflow state is not included in the array returned by workflow_allowable_transitions().

<?php
  $transitions = workflow_allowable_transitions($current_sid, 'to', $roles);
?>

at this point our current 'two' state is not in $transitions and is therefore prepended with the following code:

<?php
  if ($current_sid != _workflow_creation_state($wid)) { // include current state if not (creation)
    $transitions = array($current_sid => $states[$current_sid]) + $transitions;
  }
?>

So the $transisitons array ends up looking like this:

Array
(
    [N] => Two
    [N] => One
    [N] => Three
)

Now when action_workflow_execute_transition() matches the current state of 'Two', it sets the new state to the next element of the array, which is 'One'.

Comments

harry slaughter’s picture

The workaround I'm using for this problem is to implement a new action based on action_workflow_execute_transition()

This new action is configurable and takes the new state name explicitly. This circumvents the buggy code and allows for moving to any state, not just the next state.

Bastlynn’s picture

Status: Active » Closed (won't fix)

Hi,

With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.

- Bastlynn