Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
jvandyk CreditAttribution: jvandyk commentedFixed in 5.x-1.x-dev. Well, at least the spacing issue.
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.