You are here

function _biblio_prepare_submit in Bibliography Module 6

Same name and namespace in other branches
  1. 6.2 biblio.module \_biblio_prepare_submit()
  2. 7 biblio.module \_biblio_prepare_submit()
  3. 7.2 biblio.module \_biblio_prepare_submit()

Prepare a node for submit to database. Contains code common to insert and update.

Parameters

$node:

Return value

none

2 calls to _biblio_prepare_submit()
biblio_insert in ./biblio.module
Implementation of hook_insert().
biblio_update in ./biblio.module
Implementation of hook_update().

File

./biblio.module, line 1673

Code

function _biblio_prepare_submit(&$node) {
  require_once drupal_get_path('module', 'biblio') . '/biblio.contributors.inc';
  $node->biblio_contributors = biblio_parse_contributors($node->biblio_contributors);
  $node->biblio_year = _biblio_numeric_year($node->biblio_year);
  $node->biblio_coins = biblio_coins($node);
  if (variable_get('biblio_auto_citekey', 1) && empty($node->biblio_citekey)) {
    $node->biblio_citekey = biblio_citekey_generate($node);
  }
  $duplicate = biblio_hash($node);
  if (isset($duplicate) && $duplicate != $node->nid) {

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