Hello!
I have been out for over a month, and after coming back, I am happy to see how much activity there is here! Thanks, Ron!

Now to the bug report:

I am trying to import a file with a bibtex entry of the Conference paper type (@InProceedings). The resulting node comes without the conference title (that should go to the biblio_secondary_title field). I noticed that in the file bibtexParse/PARSEENTRIES.php, lines 626-628, function bib2node(), there is the following:

$node['biblio_secondary_title'] = (!empty($entry['journal'])) ? $entry['journal'] : NULL;
$node['biblio_secondary_title'] = (!empty($entry['booktitle'])) ? $entry['booktitle'] : NULL;
$node['biblio_secondary_title'] = (!empty($entry['series'])) ? $entry['series'] : NULL;

I guess that the the "series" entry is overwriting with a NULL value the booktitle value. And surely enough, if I add a "series" entry to my bibtex file, I get that as the Conference title.

Sorry if I am missing something in the bug report.

Cheers!
Maira

Comments

Frank Steiner’s picture

Right, this must be reworked to use case distinctions for different types, but I guess this must be done carefully and I'm not sure if can always work, esp. for custom types etc. Since we had that problem with a custom type, I'm using my hooks (http://drupal.org/node/339385, not sure if it applies to the latest develop version) and use sth. like this:

function bio_module_biblio_bibtex_import_post($entry, &$node) {
  // Always import the doi if given
  $node['biblio_doi'] = empty($entry['doi']) ? '' : $entry['doi'];
  
  switch ($entry['bibtexEntryType']){
  case 'incollection':
  case 'inproceedings':
    // We use secondary title for the booktitle and tertiary for the series
    $node['biblio_secondary_title'] = empty($entry['booktitle']) ? '' : $entry['booktitle'];
    $node['biblio_tertiary_title'] = empty($entry['series']) ? '' : $entry['series'];
    // We can have both, publisher and organization!
    $node['biblio_publisher'] = empty($entry['publisher']) ? '' : $entry['publisher'];
    $node['biblio_custom1'] = empty($entry['organization']) ? '' : $entry['organization'];
    break;
}
Frank Steiner’s picture

Hmm, I just wonder if it wouldn't be enough to remove the NULL from line 2 and 3, so that a defined biblio_secondary_title can be overwritten but not deleted anymore. I doesn't seem to make sense to remove the journal title if no book title is set...

Frank Steiner’s picture

Status: Active » Needs review
StatusFileSize
new2.05 KB
rjerome’s picture

Status: Needs review » Fixed

Added to HEAD will come to 6-1 shortly.

Ron.

dunlop’s picture

Status: Fixed » Active

I have found this change in logic to be very sensible and something that should probably be applied throughout the PARSEENTRIES.php code.

For example the original patch made a number of changes of the form:

-      $node['biblio_secondary_title'] = (!empty($entry['booktitle'])) ? $entry['booktitle'] : NULL;
+      if (!empty($entry['booktitle'])) $node['biblio_secondary_title'] =  $entry['booktitle'];

which I extended to the journal type:

-      $node['biblio_secondary_title'] = (!empty($entry['journal'])) ? $entry['journal'] : NULL;
+      if (!empty($entry['journal'])) $node['biblio_secondary_title'] =  $entry['journal'];

and that solved a problem I was having where all my journal titles were being imported empty.

But looking deeper there are many lines of code with the same logic that I think would be improved by applying the pattern established in the patch of comment #3.

Frank Steiner’s picture

I don't understand your point: The code doesn't need to be adjusted for the journal type because it is assigned first, so the biblio_secondary_title either get's the journal value or becomes NULL and I guess from phps point of view, setting the field to NULL is the same as leaving it undefined.

You need the if-then-clause only for redefining fields that could have been set before. Or I don't get what you mean....

dunlop’s picture

Ok you are likely correct when it comes to my suggested change for journal since it is assigned first. Perhaps the journal title was being put in correctly initially and then it was being overwritten by a null from booktitle or series from the pre-patched code. By that I mean before the changes of the patch from comment #3 and not my additional change.

But there are other places where my suggested changes in logic would apply. For example:

      $node['biblio_publisher']       = (!empty($entry['publisher'])) ? $entry['publisher'] : NULL;
      $node['biblio_publisher']       = (!empty($entry['organization'])) ? $entry['organization'] : NULL;
      $node['biblio_publisher']       = (!empty($entry['school'])) ? $entry['school'] : NULL;
      $node['biblio_publisher']       = (!empty($entry['institution'])) ? $entry['institution'] : NULL;

should probably be:

      $node['biblio_publisher']       = (!empty($entry['publisher'])) ? $entry['publisher'] : NULL;
      if (!empty($entry['organization'])) $node['biblio_publisher'] =  $entry['organization'];      
      if (!empty($entry['school'])) $node['biblio_publisher'] =  $entry['school'];      
      if (!empty($entry['institution'])) $node['biblio_publisher'] =  $entry['institution'];
Frank Steiner’s picture

Right, but the patch from #3 is doing exactly what you suggest for the biblio_publisher field. And I don't see any more fields that need the same treatment...

dunlop’s picture

You're right. Sorry for the interruption and keep up the good work.

rjerome’s picture

FYI, these changes are in the new -dev version.

catdevrandom’s picture

Status: Active » Closed (fixed)