You are here

function biblio_insert in Bibliography Module 7

Same name and namespace in other branches
  1. 5 biblio.module \biblio_insert()
  2. 6.2 biblio.module \biblio_insert()
  3. 6 biblio.module \biblio_insert()

Implements hook_insert().

As a new node is being inserted into the database, we need to do our own database inserts.

File

./biblio.module, line 1774
Bibliography Module for Drupal.

Code

function biblio_insert($node) {
  module_load_include('inc', 'biblio', 'includes/biblio.util');
  module_load_include('inc', 'biblio', 'includes/biblio.contributors');
  module_load_include('inc', 'biblio', 'includes/biblio.keywords');
  _biblio_prepare_submit($node);
  biblio_insert_contributors($node);
  biblio_insert_keywords($node);
  $node->biblio_coins = biblio_coins($node);
  $duplicate = biblio_hash($node);
  drupal_write_record('biblio', $node);

  // If this is a potential duplcate, write the nids of the pre-existing and new nodes.
  if (isset($duplicate) && $duplicate != $node->nid) {
    $dup_map = array(
      'vid' => $duplicate,
      'did' => $node->nid,
    );
    drupal_write_record('biblio_duplicates', $dup_map);
  }
}