Needs work
Project:
Bibliography Module
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 Oct 2011 at 19:41 UTC
Updated:
15 May 2020 at 21:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
ulysse68 commentedI had the same problem, and I solved it patching the biblio.pages.inc page -- sorry I don't use Git, so my patch isn't in the proper form. These lines affect lines 355 sq.
Hope that helps,
U.
Comment #2
ulysse68 commentedWell, forget the patch above: it produces undesired side effects -- when you filter by authors, results are not correctly displayed. I am trying another method: if it works, I'll let you know here -- but if the developers have a good solution...
U.
Comment #3
sunhuaifeng commentedI need the function too.
And i suggest to add a field in the module to support the function instead of modifying the code for general use.
Users can define the first field to sort and the secondary, also the third etc.
Different users have different needs.
thanks for your work and I'm waiting for your good news.
Comment #4
dystopic commentedI would like to suggest, that the secondary sort field should be configurable, because the specific needs for the secondary order varies depending on the environment in which the bibliography module is used. The possibility to use a custom field for the secondary order would be sufficient i would assume.
For me personally, i would like to have a secondary order depending on the publication type (papers before conference posters etc.) while the primary order is chronologically.
If the the primary order is set to publication type, i would prefer a secondary order based on the publication year.
Alphabetical order is not very helpful for me personally.
Thank you for your work!
Comment #5
ulysse68 commented+1 for a secondary sort order; but as Cliff Donath says, the default order within a year should be by author (I've never seen an order by title in references...).
Thanks!
Comment #6
ziemendorf commented+1 for this. I've been trying to figure out a way to make this work, without success.
Comment #7
anfederman commentedRelated issue?
When pasting a bibtext record and editing secondary author becomes series author.
I.e. it is edited as secondary author but displays as series author.
Title Play and early childhood development.
Publication Type Book
Year of Publication 1999
Authors Johnson, JE
Series Editor Christie, JF
Tertiary Authors Yawkey, TD
Publisher Longman
original +
@Book{
author = "Johnson, J.E.; Christie, J.F. and Yawkey, T.D.",
title = "Play and early childhood development.",
publisher = "Longman",
year = 1999
}
Comment #8
lenov commented+1 for a secondary sort, by first author family name if not configurable.
I also reproduced anfederman's bug.
Comment #9
rkneale commentedIt's been a while, but add another vote for secondary sort by author last name.... I've just started playing with Biblio and it could be everything we need, except for that problem.
Comment #10
rkneale commentedNever mind, I figured it out! Hope everyone else was able to, and I do really hope this shows up as the default in the next release, but until then a tweak of the biblio.pages.inc file made all the difference.
Comment #11
ulysse68 commentedCould you be more specific, please? I haven't figured it out, yet...
Comment #12
toomanychrises commentedYou figured it out and didn't post the solution... Please never visit this forum again because you are useless. The point of this is to share information.
Comment #13
toomanychrises commentedFor those of you coming to this and perhaps not as adept in code- here is a solution that you can try. I needed to change the secondary sort for "Type" from the Title to the Year. You will notice above the approximate location of the code you need to change and it is a bit intuitive with trail and error, but in the interest of saving time I changed:
line 374
$query->orderBy('biblio_sort_title', $order);
change to:
for primary author as the second sort, this worked for me:
It would be great if someone with a better understanding of php and this module could post how to sort $query->orderBy('biblio_year', $order); in descending order from most recent year first.
Comment #14
toomanychrises commentedfollow-up for the Year secondary sort:
I made a new variable called $ordertype since this if for the Type sort and set it to DESC for descending so it would affect only that sort.
Comment #15
ulysse68 commentedComment #16
ulysse68 commentedAs stated in this issue, the problem of sorting by year and author could be solved if we could use the "biblio citation" field as a sort criteria.
I could manage, using biblio_views, to sort by year and first author -- but it is not enough if you have many authors.
Does anyone have an idea on where to customize this "biblio citation" field? Is it only created on the fly?
Comment #17
St_B commentedyes biblio citation is created each time you run the view, and not stored. It can be a problem if you have many results on the page, the view can become very long. We chose to create some cck fields instead, filled with the result of functions used to generate biblio citation. We store the Harvard citation in one field, Vancouver one in another.
Comment #18
museumboy commentedIs there anyway to do this if you don't have access to the biblio module files? A template.php hook? We really need this as a feature.
Comment #19
keramsey commentedHere is a patch against biblio version 7.x-1.0-rc7 that sets secondary sorting within year by primary author which needs testing, but seems to work. Based on comment #13 by toomanychrises.
Comment #20
keramsey commentedRan into issues with array variables not being declared (PHP 7.1) and broken author links except when filter was set to title. This was related to the secondary sorting changes (e.g., sort by author, publication title). See comment # 2 at https://www.drupal.org/node/1938512#comment-7168562 for more information.
Patch created against 7.x-1.0-rc7.
My environment:
PHP 7.1
CentOS 7
MariaDB 10.1.25
Aegir 7.x-3.10
Drush 8.1.10
Needs review.
Comment #21
keramsey commentedI found that my earlier patch created an issue that kept non-first authored publications from appearing in a user's publications listing within their profile page.
I created a duplicate of includes/biblio.pages.inc as includes/biblio.profile.pages.inc to allow for separating the sorting logic to for profile publications pages from the rest of biblio pages. I am not sure that the naming convention for the biblio.profile.pages.inc file meets Drupal best practices.
I think there is a more efficient way to modify the sort select case without duplicating the entire include file (biblio.pages.inc). I would appreciate anyone's comments on the include file naming and my approach to separating (filtering) the user profile publications listings from other biblio pages.
I have created a new patch based on biblio-7.x-1.x-dev. Patch needs review.
Comment #22
keramsey commentedPatch #21 needs review
Comment #23
keramsey commentedPatch #21 was actually built against 7.x-1.x-dev, not 7.x-1.0-rc11.
Comment #24
liam morlandThere is no need to duplicate the entire file and having duplicate function names won't work anyway. There can be conditional logic around setting the sort order.
Comment #25
museumboy commentedThe question I have is how to code the sort so it's by:
Date
Primary Author last name
Secondary Author last name
Tertiary....
Title
If the same author publishes in one year then the next listing should be sorted by the secondary author last name, and so on, then by title
Comment #26
liam morlandSQL allows as many ORDER BY clauses as you want.
Comment #27
keramsey commentedHere is an updated patch against 7.x-1.x-dev. I cleaned up the code to use conditional logic as suggested by Liam.
Needs testing.
Comment #28
keramsey commentedComment #29
liam morlandThanks for the patch.
I'm not familiar with having more than just a value on the
caseline. It may work, but I don't see it documented on php.net, so that makes me hesitate to use it. Please write-write using anifstatement and remove as much of the code duplication as possible.Please check your coding standards. Comments are supposed to go on the line before, not at the end of the line.