Different naming conventions of $op value for trigger_assignment table in workflow module

M_Z - July 10, 2009 - 09:16
Project:Workflow
Version:6.x-1.1
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

I'm using Drupal 6 and recognized some problems with workflow module (6.x-1.1, but I also checked current dev version). There is some interaction between workflow module and trigger module and I found 3 different naming conventions of $op value for trigger_assignment table (all in file workflow.module).

In function workflow_workflow():
      $op = 'workflow-'. $node->type .'-'. $tid;

In function workflow_get_actions():
  $op = 'workflow-'. $tid;

In function workflow_actions_remove():
  db_query("DELETE FROM {trigger_assignments} WHERE hook = '%s' AND op = '%s' AND aid = '%s'", 'workflow', 'workflow'. $tid, $aid);

So in the 3rd function the $op value is 'workflow'. $tid (without hyphen).

In function workflow_hook_info() we can find the first $op pattern again:
    $pseudohooks['workflow-'. $data->type .'-'. $data->tid] = array('runs when' => t('When %type moves from %state to %target_state', array('%type' => $data->type, '%state' => $states[$data->sid], '%target_state' => $states[$data->target_sid])));

I think this is a bug and will cause some unwanted behaviour, right?

I also have a suggestion: changing the prefix from 'workflow-' to 'wf-' would reduce problems caused by long node type names (max. 32 characters) because the op column in trigger_assignment table has also only max. 32 characters. Maybe you could realize this when you adapt the $op values in your workflow module.

Thanks in advance,
Martin

P.S.: I learned a lot from your great book 'Pro Drupal Development'. Many thanks.

#1

M_Z - July 27, 2009 - 21:26
Priority:normal» critical

Maybe a change of priority will attract someone's attention...

 
 

Drupal is a registered trademark of Dries Buytaert.