You are here

function workflow_insert_workflow_node_history in Workflow 7

Same name and namespace in other branches
  1. 7.2 workflow.deprecated.inc \workflow_insert_workflow_node_history()

Given data, insert a new history. Always insert.

3 calls to workflow_insert_workflow_node_history()
WorkflowTransition::execute in includes/Entity/WorkflowTransition.php
Execute a transition (change state of a node). @deprecated: workflow_execute_transition() --> WorkflowTransition::execute().
workflow_node_delete in ./workflow.node.inc
Implements hook_node_delete().
workflow_update_workflow_node in ./workflow.module
Given data, insert the node association. @todo: Can we split this in 2? First half for Node API, second half for Node + Field API.

File

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

Code

function workflow_insert_workflow_node_history($data) {
  $data = (object) $data;
  if (isset($data->hid)) {
    unset($data->hid);
  }

  // Check for no transition.
  if ($data->old_sid == $data->sid) {

    // Make sure we haven't already inserted history for this update.
    $last_history = workflow_get_workflow_node_history_by_nid($data->nid, 1);
    if (isset($last_history) && $last_history->stamp == REQUEST_TIME) {
      return;
    }
  }
  drupal_write_record('workflow_node_history', $data);
}