You are here

function _workflow_node_to_state in Workflow 6.2

Same name and namespace in other branches
  1. 5.2 workflow.module \_workflow_node_to_state()
  2. 5 workflow.module \_workflow_node_to_state()
  3. 6 workflow.module \_workflow_node_to_state()

Put a node into a state. No permission checking here; only call this from other functions that know what they're doing.

Parameters

object $node:

int $sid:

See also

workflow_execute_transition()

1 call to _workflow_node_to_state()
workflow_execute_transition in ./workflow.module
Execute a transition (change state of a node).

File

./workflow.module, line 1050
Support workflows made up of arbitrary states.

Code

function _workflow_node_to_state($node, $sid, $comment = NULL) {
  global $user;
  $node->workflow_stamp = time();
  if (db_result(db_query("SELECT nid FROM {workflow_node} WHERE nid = %d", $node->nid))) {
    db_query("UPDATE {workflow_node} SET sid = %d, uid = %d, stamp = %d WHERE nid = %d", $sid, $user->uid, $node->workflow_stamp, $node->nid);
  }
  else {
    db_query("INSERT INTO {workflow_node} (nid, sid, uid, stamp) VALUES (%d, %d, %d, %d)", $node->nid, $sid, $user->uid, $node->workflow_stamp);
  }
  _workflow_write_history($node, $sid, $comment);
}