You are here

function biblio_contributor_pre_save in Bibliography Module 7.2

Perform actions to a contributor object before saving

Parameters

object $contributor:

Return value

success of operations

1 call to biblio_contributor_pre_save()
biblio_contributor_save in ./biblio.module
Save contributor.

File

includes/biblio.contributors.inc, line 242

Code

function biblio_contributor_pre_save($contributor) {
  $rank = 0;
  $wrapper = biblio_wrapper($contributor, 'biblio_contributor');
  $name = $wrapper->biblio_contributor_name
    ->value();
  $cid = $wrapper->cid
    ->value();
  $md5 = $wrapper->md5
    ->value();
  if (!isset($md5) || empty($md5)) {
    $wrapper->md5 = _md5sum($contributor);
  }
  if (!empty($name)) {
    if (empty($cid) && !variable_get('biblio_contributor_parser', 1)) {
      biblio_parse_author($contributor);
    }
  }
  $contributor->title = $name;

  //TODO  check if it is necessary to reset aka here...

  //  db_query("UPDATE {biblio_contributor_data} SET aka = cid WHERE aka = 0 OR aka IS NULL");
  //  db_update('biblio_contributor_data')
  //    ->fields(array('aka', )
  return TRUE;

  // successfully saved all contributors
}