We are using the biblio module on our site and prefer to sort authors by last name. The problem, however, is that a secondary sort--by year--is applied automatically, so the bibliography may look like:

Sandler, A (2009)
Smith, J (2008)
Sandler, A (2007)

I have not found any way to turn off the secondary sort so the only sort is by last name:

Sandler, A (2009)
Sandler, A (2007)
Smith, J (2008)

Is there any way to turn this off? Perhaps this is something for a future release.

Thanks

Comments

rjerome’s picture

There is no way to turn this off without editing the code.

It is however a long standing feature request.

Ron.

uw07’s picture

Thanks very much for the reply. Could you possibly direct me to the code that needs to be edited? Or to another post that describes how to edit the code to turn the secondary, "by year" sort off.

rjerome’s picture

You would have to edit the biblio.module file and near the top of the biblio_db_search function you will see this starting at line 1866

  switch ($pager_attrib['sort']) {
    case 'type':
      $sortby = "ORDER BY b.biblio_type %s, b.biblio_year DESC, SUBSTRING(n.title,1,1) ASC ";
      break;
    case 'title':
      $sortby = "ORDER BY SUBSTRING(n.title,1,1) %s, b.biblio_year DESC ";
      break;
    case 'author':
      /*$join[] = "inner join {biblio_has_author} as ha on a.aid = ha.aid"; 
      $join[] = "inner join  {biblio_author_index} as a on b.nid= ha.nid";
      $sortby = " ORDER BY a.author %s ";
      $where[] = "ha.rank = 1 ";
      */
      $sortby = "ORDER BY SUBSTRING(LTRIM(b.biblio_authors),1,1) %s, b.biblio_year DESC ";
      break;
    case 'keyword': // added msh 070808
      $sortby = "ORDER BY SUBSTRING(LTRIM(b.biblio_keywords),1,4) %s, b.biblio_keywords ASC ";
    break;
    case 'year':
    default:
      $sortby = "ORDER BY b.biblio_year %s, b.biblio_date DESC, SUBSTRING(n.title,1,1) ASC, b.biblio_type ASC ";
  } //end switch

you will want to change line 1879 which currently looks like this...

      $sortby = "ORDER BY SUBSTRING(LTRIM(b.biblio_authors),1,1) %s, b.biblio_year DESC ";

and remove the "b.biblio_year DESC" so it looks like this...

      $sortby = "ORDER BY SUBSTRING(LTRIM(b.biblio_authors),1,1) %s ";
uw07’s picture

Thank you! Your time and assistance are very much appreciated.

bekasu’s picture

Status: Active » Closed (fixed)

Marking issue closed.