There is a broken sql query in workflow_allowable_transitions() in workflow.module (lines 1733-1743). I'm at work at the moment and can't create a patch, sorry.

This is the query as in 5.x-1.x-dev from April 4th:

  $result = db_query(
    "(SELECT t.tid, t.%s as state_id, s.state AS state_name, s.weight AS state_weight "
    . "FROM {workflow_transitions} t "
    . "INNER JOIN {workflow_states} s "
    . "ON s.sid = t.%s "
    . "WHERE t.%s = %d "
    . "ORDER BY state_weight) "
    . "UNION "
    . "(SELECT s.sid as tid, s.sid as state_id, s.state as state_name, s.weight as state_weight"
    . "FROM {workflow_states} s "
    . "WHERE s.sid = %d) "
    . "ORDER BY state_weight, state_id", $field, $field, $field_where, $sid, $sid);

Note the missing space behind "(SELECT s.sid as tid, s.sid as state_id, s.state as state_name, s.weight as state_weight" and the wrongly placed parentheses for the second part of the UNION in the last two lines.

This should be correct:

  $result = db_query(
    "(SELECT t.tid, t.%s as state_id, s.state AS state_name, s.weight AS state_weight "
    . "FROM {workflow_transitions} t "
    . "INNER JOIN {workflow_states} s "
    . "ON s.sid = t.%s "
    . "WHERE t.%s = %d "
    . "ORDER BY state_weight) "
    . "UNION "
    . "(SELECT s.sid as tid, s.sid as state_id, s.state as state_name, s.weight as state_weight "
    . "FROM {workflow_states} s "
    . "WHERE s.sid = %d "
    . "ORDER BY state_weight, state_id)", $field, $field, $field_where, $sid, $sid);

Comments

jvandyk’s picture

Status: Active » Fixed

Fixed in 5.x-1.x-dev. Well, at least the spacing issue.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.