When you edit an entry and change the name of a contributor, the old contributor is not deleted in the biblio_update() hook. Thus, an orphaned contributor (which is probably misspelled) remains in the database.

It would be then desirable to remove orphaned contributors automatically, which can be done adding the query:

db_query('DELETE FROM {biblio_contributor_data} WHERE cid NOT IN (SELECT DISTINCT(cid) FROM {biblio_contributor})');

In the biblio_update() hook, which removes contributors which are not related to a node. The same can be done for removed nodes in the biblio_delete() hook.

Would this have an undesired side effect?

Comments

rjerome’s picture

The reason it's not done automatically is that in some cases you may want to prepopulate or retain authors in the database in order to enhance the autocomplete capability. i.e. a university might enter all it's faculty members so that when entering a new paper, auto-complete will produce consistent results.

I could make it an option to automatically delete orphans if so desired.

Ron.

mlncn’s picture

+1 for an option to delete orphaned authors automatically. Where we (some SCF sites) have all our data pulled in from pubmed, this helps us keep the data clean.

benjamin, Agaric Design Collective

rjerome’s picture

Version: 6.x-1.0-rc5 » 6.x-1.x-dev
Status: Needs review » Fixed

This is now in the -dev release. Look for an option on the settings page under the "Authors" section. It is turned OFF by default.

Ron.

mlncn’s picture

Fantastic! Tested and approved, heh.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.