CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • strict search parameter
Pages: [1]

Author Topic: strict search parameter  (Read 1114 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
strict search parameter
May 13, 2009, 08:26:24 am
Hello,

I have contacts with a field (eg employer), and I want to list all the contacts where this field has a value X.

with the profile /civicrm/profile?gid=A&force=1&current_employer=X is "translated" into

where current_employer like "%X%", so if I look for "new york", I get all the employees of "new york", "new york police", "new york whatelse"...


is there a way of changing so it does a strict search instead of a %like% ? (changing the code won't be a problem)

Tia

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: strict search parameter
May 13, 2009, 11:43:43 am

CRM/Profile/Selector/Listings.php, line 180

Code: [Select]
       $queryParams =& CRM_Contact_BAO_Query::convertFormValues( $this->_params, 1 );

You can change that to:

Code: [Select]
       $queryParams =& CRM_Contact_BAO_Query::convertFormValues( $this->_params, 0 );
 

Note that this removes all wildcards from all params. If you want to do it for one specific parameter only, your best bet would be to fix the convertFormValues function in Query.php

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: strict search parameter
May 13, 2009, 12:08:02 pm
Works great !
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
but not for the current_employer
May 14, 2009, 12:04:06 am
For the custom fields, works great but the current employer is still like %X%

Trying to find...
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: strict search parameter
May 14, 2009, 08:27:08 am

try adding some debugging code to:

CRM/Contact/BAO/Query.php, line 1439 onwards

will give u an idea of whats happening and why

lobo

A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Profiles (Moderator: Dave Greenberg) »
  • strict search parameter

This forum was archived on 2017-11-26.