When importing a file using the BibTex format, the following error was given when an entry has no author:

warning: Invalid argument supplied for foreach() in ...\sites\all\modules\biblio\bibtex.php on line 1192. 

This patch inserts "Author(s) Unavailable" in lieu of the Author's name.

CommentFileSizeAuthor
#2 bibtex_php_sort_authors.png48.02 KBAnonymous (not verified)
bibtex_import_without_authors.patch1.31 KBAnonymous (not verified)

Comments

Anonymous’s picture

Status: Reviewed & tested by the community » Needs review

Mmmmm.. The patch actually breaks the order when sorted by Author.

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new48.02 KB

And now I realize it doesn't break it. It kinda "fixes" it... But not really.

Importing data with the original bibtex.php, then sorting this way: sort=author&order=asc. There seems to be only one section (a div oddly named biblio-year) for all entries of all authors which name starts with a capitalized letter. The results in this div are correctly sorted in alpha order.

On the other hand, all records where the author's name starts with a lower case letter are sorted correctly in their respected div e.g. <div class="biblio-year">d</div>.

When I do an import with the patch discussed in this thread, I get the same results except one difference: the entires which have no Authors (mapped to "Author(s) Unavailable") actually show up with the proper divider <div class="biblio-year">A</div>.

See screenshot.

Francis

rjerome’s picture

I'm not so sure that putting "Author Unavailable" in the database is a good idea. Maybe we should just leave the author field blank and then deal with it when doing the listing.

Yes, that DIV is poorly named, there was a time when there was only sorting by year, so it made some sense then, I just haven't got around to changing it to something more sensible.

Ron.

Anonymous’s picture

I just landed my hands on the Publication Manual of the American Psychological Association. The following rules apply to the APA style:

"Newsletter/Newspaper Article: Alphabetize works with no authors by the first significant word in the title."

Example: The new health-care lexicon. (1993, August/September). Copy Editor, 4, 1-2.

Should be sorted by "new".

"Book: Place the title in the author position. Alphabetize works with no authors by the first significant word in the title."

Example: Merriam-Webster's collegiate dictionary (10th ed.). (1993). Springfield, MA: Merriam-Webster.

So your approach seems to be correct.

rjerome’s picture

I think I found the reason that no character was being output in the separator bar. I just saw this in my installation and discovered that some of the entries in biblio_authors have leading white space, which is exactly what is being put in the separator bar. I have since added some code to compensate for this possibility, as well as upper casing all the first letters so you don't end up with the upper and lower case names sorted separately.

Ron.

catdevrandom’s picture

Status: Reviewed & tested by the community » Closed (fixed)