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

CRM:4287 - add searchPrimaryDetailsOnly setting #9772

Merged
merged 5 commits into from
Mar 8, 2017

Conversation

jitendrapurohit
Copy link
Contributor

@jitendrapurohit jitendrapurohit commented Feb 3, 2017

jitendrapurohit and others added 5 commits February 3, 2017 14:55
…PrimaryDetailsOnly".

Location types are not primaries, contact could have several emails of any location type but only one email (not location type) should be their "primary".
@@ -514,7 +514,7 @@ public function initialize($apiEntity = NULL) {
CRM_Financial_BAO_FinancialType::buildPermissionedClause($this->_whereClause, $component);
}

$this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode);
$this->_fromClause = self::fromClause($this->_tables, NULL, NULL, $this->_primaryLocation, $this->_mode, $apiEntity);
Copy link
Contributor

Choose a reason for hiding this comment

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

when I last looked at this apiEntity seemed to duplicate $this->_mode.

Copy link
Member

Choose a reason for hiding this comment

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

Actually $this->_mode contain the constant values specified in https://github.com/jitendrapurohit/civicrm-core/blob/master/CRM/Contact/BAO/Query.php#L47 and apiEntity is assigned with string entity values e.g. Contact, Participant etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just for the record, I still don't understand how that isn't just duplicating mode in a different format (you don't need to respond to this - it has been merged & it is not a 'live' concern)

@monishdeb
Copy link
Member

Tested working fine.

  1. Created two email test1@test.com (as primary) and test2@test.com for contact A
    image

  2. On searchPrimaryDetailsOnly = TRUE AND email LIKE %test2%
    image

  3. On searchPrimaryDetailsOnly = FALSE AND email LIKE %test2%
    image

@monishdeb
Copy link
Member

Also works for phone, im and openid

@colemanw colemanw merged commit de87320 into civicrm:master Mar 8, 2017
@jitendrapurohit jitendrapurohit deleted the CRM-4287fix branch March 24, 2017 11:25
monishdeb pushed a commit to monishdeb/civicrm-core that referenced this pull request May 2, 2017
CRM:4287 - add searchPrimaryDetailsOnly setting
@petednz
Copy link

petednz commented May 16, 2018

Does this work for QuickSearch - or will that require additional work? @jitendrapurohit an estimate if that is the case pls

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.

6 participants