Results 1 to 7 of 7
Like Tree3Likes
  • 3 Post By mikesolomon

Thread: Auto wildcard %

  1. #1
    LBento is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    10

    Default Auto wildcard %

    Hi guys,

    I needed that the Basic Search auto assume that it has % (wildcards) at the beggining and at the end of the string I enter.

    I can not find the .php file/where to edit it. I believe it should be quite easy as it should be add % at the query that takes the string.

    Please help

  2. #2
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: Auto wildcard %

    Have a look at include/SearchForm/SearchForm/SearchForm2.php

    I did this by adding the following line after case 'like'

    if (! preg_match('/\%/',$field_value) && $type != 'bool') $field_value = '%' . $field_value . '%';
    ckd1987, SaintAnthony and sta0g like this.
    Mike Solomon
    Development Manager
    Ivy Ltd
    www.ivy.ltd.uk]www.ivy.ltd.uk

    php version 5.2.6
    MySql 5.1.59

  3. #3
    robertbmirth is offline Sugar Community Member
    Join Date
    Jun 2010
    Location
    Irvine, CA
    Posts
    345

    Default Re: Auto wildcard %

    Any idea how to do this in an upgrade safe manner?
    Robert Beckman
    Software Engineer
    Mirth Corporation

  4. #4
    LBento is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    10

    Default Re: Auto wildcard %

    What about custom fields, do they get in this page SearchForm2.php?

  5. #5
    LBento is offline Sugar Community Member
    Join Date
    Jul 2011
    Posts
    10

    Default Re: Auto wildcard %

    I wanted to add auto wildcard % to all the fields anyway I can insert that codeline to make it count for all the fields?

    Thank you

  6. #6
    SaintAnthony is offline Sugar Community Member
    Join Date
    Sep 2011
    Posts
    24

    Default Re: Auto wildcard %

    It does seem to work for all fields, I inserted the code like this:

    case 'like':
    if (! preg_match('/\%/',$field_value) && $type != 'bool') $field_value = '%' . $field_value . '%';
    if($type == 'bool' && $field_value == 0) { $where .= $db_field . " = '0' OR " . $db_field . " IS NULL";

    Hope that helps!

  7. #7
    ckd1987 is offline Sugar Community Member
    Join Date
    Jan 2008
    Posts
    88

    Default Re: Auto wildcard %

    Quote Originally Posted by mikesolomon View Post
    Have a look at include/SearchForm/SearchForm/SearchForm2.php

    I did this by adding the following line after case 'like'

    if (! preg_match('/\%/',$field_value) && $type != 'bool') $field_value = '%' . $field_value . '%';

    this is working in Sugar CRM 6.4.RC3

    Row 939

    Code:
    case 'like':
    if (! preg_match('/\%/',$field_value) && $type != 'bool') $field_value = '%' . $field_value . '%';

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Account Search Wildcard
    By madcoder1988 in forum Help
    Replies: 10
    Last Post: 2011-01-24, 06:58 PM
  2. searching without using wildcard (%)
    By Pepin in forum Help
    Replies: 2
    Last Post: 2009-05-26, 01:57 AM
  3. Using wildcard in a workflow rule
    By yoggiecrm in forum General Discussion
    Replies: 2
    Last Post: 2008-08-19, 10:11 PM
  4. Wildcard character
    By wjohnson in forum Feature Requests
    Replies: 0
    Last Post: 2008-02-05, 10:30 PM
  5. UnifiedSearch wildcard
    By brob in forum General Discussion
    Replies: 12
    Last Post: 2006-11-19, 05:20 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •