Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Query.php #8238

Closed
wants to merge 2 commits into from
Closed

Update Query.php #8238

wants to merge 2 commits into from

Conversation

yurg
Copy link
Contributor

@yurg yurg commented Apr 26, 2016

Let's sort it in alphabet order (sort_name asc) by default, for now it sorts by ID each time more than one search criteria is being selected
(like part of the name and relationship type, etc.)

   Let's sort it in alphabet order (sort_name asc)  by default, for now it sorts by ID each time more than on search criteria is being selected 
   (like part of the name and relationship type, etc.)
@civicrm-builder
Copy link

Can one of the admins verify this patch?

@totten
Copy link
Member

totten commented Apr 26, 2016

jenkins, ok to test

@eileenmcnaughton
Copy link
Contributor

This function is called from LOTS of places so it's kinda a scary change to make. You probably want to start by logging a JIRA & fleshing out your reasoning & where you are experiencing a bad sort that this would fix https://issues.civicrm.org/jira/

@eileenmcnaughton
Copy link
Contributor

NB - the jenkins warnings are because we follow drupal whitespace coding standards & jenkins tests against them with phpcs

https://www.drupal.org/coding-standards

@agh1
Copy link
Contributor

agh1 commented May 12, 2016

Jenkins, retest this please

@agh1
Copy link
Contributor

agh1 commented May 12, 2016

@yurg I'm going through a number of open PRs that may be considered for 4.7.8, and to be considered, this will need the tests to be passing. It looks like you've got some spaces at the end of a couple of lines (see the test results).

If you can commit your fixes in the next couple of days and the tests pass, we'll be able to consider it for merging this month.

@yurg
Copy link
Contributor Author

yurg commented May 13, 2016

Not sure I did it right, have used browser edit mode; besides Jenkins has pointed to a different line numbers; but at least I've tried.

@yashodha
Copy link
Contributor

jenkins test this please

@eileenmcnaughton
Copy link
Contributor

test this please

@JoeMurray
Copy link
Contributor

Hi @yurg as Release Manager this month, I'm trying to recruit people to help pare down the backlog of almost 100 PRs, some going back to last summer. I'm wondering if you would be able to help QA another PR if I got someone to QA this PR?

@yurg
Copy link
Contributor Author

yurg commented Jun 13, 2016

Hi @JoeMurray , not really sure what exactly should I do but I'm ready to help.

$order = $orderBy = $limit = '';
// let's sort it in alphabet order by default, for now it sorts by ID each time more than on search criteria is being selected
// (like part of the name and relationship type, etc.)
$order = " order by contact_a.sort_name asc";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yurg for consistency, I think order by should be uppercased.

@colemanw
Copy link
Member

Based on the above comments I'm closing this PR until we have a jira ticket with rationale, and unit tests.

@colemanw colemanw closed this Jun 18, 2016
@JoeMurray
Copy link
Contributor

Agreed re: 1) strong need for unit tests on well-used function, and 2) need for JIRA issue explaining intent.

@civicrm-builder
Copy link

Can one of the admins verify this patch?

@JoeMurray
Copy link
Contributor

@yurg just guessing what is going here, but you are wanting to change the sort order in some part of CiviCRM so that contacts default to alphabetic. I'd suggest you discuss in dev channel on chat.civicrm.org or perhaps post a question to civicrm.stackexchange.com regarding what you are trying to achieve, and ask about the best way to do it. There is likely some code that is more specific to your interest that could be modified, or it might be that some of the Search Preferences under Admin menu may be enough, depending on what you want.

@yurg
Copy link
Contributor Author

yurg commented Jun 23, 2016

@JoeMurray Exactly; alphabet sorting by default is more "human-friendly" than default sort by Contact ID; not sure why, but "Search preferences" tokens don't work, whatever combination of {title} {first_name}{last_name} I've tried.
Have tried to search at civicrm.stackexchange.com / civicrm forums, but, if memory serves, have got only something like "you have to hire someone to do this.." Hence, moving Query.php into custom php directory and altering it worked pretty good until one of recent updates, where a lot of original Query.php code was changed.
Whatever, the bottom line is, alphabet search results sort is way more intuitive / user-friendly so it would be nice to have it implemented by default.

@JoeMurray
Copy link
Contributor

I wasn't thinking of tokens but the options under Admin > Custom Data and Screens > Search Preferences, Include Order By Clause and Include Alphabetical Pager

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants