/** * Insert (no update) a transition. * * @deprecated workflow_insert_workflow_node_history() --> WorkflowTransition::save() */ public function save($entity, DatabaseTransaction $transaction = NULL) { // Check for no transition. if ($entity->old_sid == $entity->new_sid) { if (!$entity->comment) { // Write comment into history though. return; } } // Make sure we haven't already inserted history for this update. $last_history = workflow_transition_load_single($entity->entity_type, $entity->entity_id, $entity->field_name, $entity->language); if ($last_history && $last_history->stamp == REQUEST_TIME && $last_history->new_sid == $entity->new_sid) { return; } else { unset($entity->hid); $entity->stamp = REQUEST_TIME; return parent::save($entity, $transaction); } }
/** * Insert (no update) a transition. * * deprecated workflow_insert_workflow_node_history() --> WorkflowTransition::save() */ public function save($entity, DatabaseTransaction $transaction = NULL) { // Check for no transition. if ($entity->old_sid == $entity->new_sid) { if (!$entity->comment) { // Write comment into history though. return; } } if (empty($entity->hid)) { // Insert the transition. Make sure it hasn't already been inserted. $last_history = workflow_transition_load_single($entity->entity_type, $entity->entity_id, $entity->field_name, $entity->language); if ($last_history && $last_history->stamp == REQUEST_TIME && $last_history->new_sid == $entity->new_sid) { return; } else { unset($entity->hid); $entity->stamp = isset($entity->stamp) ? $entity->stamp : REQUEST_TIME; return parent::save($entity, $transaction); } } else { // Update the transition. return parent::save($entity, $transaction); } }