You are here

function workflow_ng_condition_workflow_transition_is in Workflow 5.2

File

contrib/workflow_workflow_ng/workflow_workflow_ng.module, line 64

Code

function workflow_ng_condition_workflow_transition_is($node, $settings) {

  //get node workflow, check against settings
  workflow_node_current_state($node);
  $from_state = $settings['from_state'];
  $to_state = $settings['to_state'];
  $result = db_query_range("SELECT h.* FROM {workflow_node_history} h WHERE nid = %d ORDER BY stamp DESC", $node->nid, 0, 1);
  if ($row = db_fetch_object($result)) {
    if ((in_array($row->old_sid, $from_state) || isset($from_state['ALL'])) && (in_array($row->sid, $to_state) || isset($to_state['ALL']))) {
      return true;
    }
  }
  return false;
}