You are here

function _reset_endnote_xml_map in Bibliography Module 7

Same name and namespace in other branches
  1. 6.2 modules/endnote/biblio_xml.install \_reset_endnote_xml_map()
  2. 7.2 modules/endnote/biblio_xml.install \_reset_endnote_xml_map()
2 calls to _reset_endnote_xml_map()
biblio_xml_endnote7_map_reset in modules/endnote/biblio_xml.module
biblio_xml_endnote8_map_reset in modules/endnote/biblio_xml.module

File

modules/endnote/biblio_xml.install, line 82
Database table creation for biblio_xml module.

Code

function _reset_endnote_xml_map($version, $type) {
  $count = db_query("SELECT COUNT(*) FROM {biblio_type_maps} WHERE format=:format", array(
    ':format' => $version,
  ))
    ->fetchField();

  // Update.
  if ($count && $type) {
    $function = '_get_' . $version . '_' . $type;
    if (!function_exists($function)) {
      return;
    }
    $map = $function();
    drupal_write_record('biblio_type_maps', $map, 'format');
    db_update('biblio_type_maps')
      ->fields($map)
      ->condition('format', $version)
      ->execute();
  }
  else {
    db_delete('biblio_type_maps')
      ->condition('format', $version)
      ->execute();
    $save_maps = '_save_' . $version . '_maps';
    $save_maps();
  }
}