Index: biblio.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/biblio/biblio.admin.inc,v
retrieving revision 1.28
diff -r1.28 biblio.admin.inc
928,929c928,929
<     case "author_dup" :
<       return ('SELECT lastname, firstname, initials, COUNT(lastname) as cnt  FROM {biblio_contributor_data} GROUP BY lastname HAVING cnt>1 ORDER BY lastname ASC, firstname ASC, initials ASC ');
---
>     case "author_dup" : // Duplicates have the same lastname, firstname and initials 
>       return ('SELECT lastname, firstname, initials, COUNT(lastname) as cnt  FROM {biblio_contributor_data} GROUP BY lastname, firstname, initials HAVING COUNT(*)>1 ORDER BY lastname ASC, firstname ASC, initials ASC ');
932c932
<       return ('SELECT lastname, cid FROM {biblio_contributor_data} where lastname LIKE "%s"');
---
>       return ("SELECT lastname, cid FROM {biblio_contributor_data} where lastname LIKE '%s'");
935c935
<       return ('SELECT bd.lastname, b.cid,COUNT(*) AS cnt FROM {biblio_contributor} b, {biblio_contributor_data} bd WHERE bd.cid=b.cid GROUP BY b.cid HAVING cnt > 0 ORDER BY lastname ASC');
---
>       return ('SELECT bd.lastname, b.cid,COUNT(*) AS cnt FROM {biblio_contributor} b, {biblio_contributor_data} bd WHERE bd.cid=b.cid GROUP BY b.cid, bd.lastname HAVING COUNT(*) > 0 ORDER BY lastname ASC');
983,984c983,989
<   // We need this complex query to realize author_types which are not in use (cid is null)
<   $db_result = db_query("SELECT ctd.*, cid FROM {biblio_contributor_type_data} ctd
---
>   // We need this complex query to realize author_types which are not in use (count(cid) is zero).
>   // Grouping by title and hint (which are functionally dependent on auth_type)
>   // is required by the SQL standard, i.e., as a rule, in a query with a GROUP
>   // BY clause, only attributes appearing in the GROUP BY
>   // clause, or aggregate functions, may be selected.
>   // (PostgreSQL enforces this rule).
>   $db_result = db_query("SELECT ctd.*, count(cid) as cid FROM {biblio_contributor_type_data} ctd
986c991
<                          GROUP BY ctd.auth_type");
---
>                          GROUP BY ctd.auth_type, ctd.title, ctd.hint");
988,989c993,995
<     $ops = l(t('edit'), 'admin/settings/biblio/author/type/'.$row->auth_type.'/edit' );
<     if (!isset($row->cid) && $row->auth_type >= 10) { // allow delete only if type not in use
---
>     $ops = l(t('edit'),
>     'admin/settings/biblio/author/type/'.$row->auth_type.'/edit' );
>     if ($row->cid == 0 && $row->auth_type >= 10) { // allow delete only if type not in use
1146c1152
<   $authors = db_query("SELECT * FROM {biblio_contributor_data} cd WHERE LOCATE('$author->lastname', name) AND cid!=$author_id");
---
>   $authors = db_query("SELECT * FROM {biblio_contributor_data} cd WHERE name LIKE '%$author->lastname%' AND cid!=$author_id");
1204a1211
>     // CHECK THIS PART
1247c1254,1255
<   $keywords = db_query("SELECT * FROM {biblio_keyword_data} kd WHERE LOCATE('%s', word) AND kid!=%d", drupal_substr($keyword->word,1,5), $keyword_id);
---
>   $keywords = db_query("SELECT * FROM {biblio_keyword_data} kd WHERE
>   word LIKE '%%s%' AND kid!=%d", drupal_substr($keyword->word,1,5), $keyword_id);
