Results 1 to 7 of 7

Thread: Hard Coding Wildcard for Search

  1. #1
    Rjrobinson is offline Member
    Join Date
    Apr 2009
    Posts
    9

    Default Hard Coding Wildcard for Search

    Where would you hard code a "%" wildcard into the Leads module for searches on an Account Name for 5.2?
    I've found other references to this but they seem to apply to older versions.

    Thanks for the help...

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Hard Coding Wildcard for Search

    Hi Robinson

    Actually what do you want to do?

    Cheers
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    Rjrobinson is offline Member
    Join Date
    Apr 2009
    Posts
    9

    Default Re: Hard Coding Wildcard for Search

    I want to be able to search for an account in the Leads module for any instance of a string or partial string. Right now I am using the "%" to accomplish this.

    I would like to hard code this into the search since most of my searches are done this way.

    Thanks for the help...

  4. #4
    optsysonl is offline Junior Member
    Join Date
    Jul 2009
    Posts
    2

    Default Re: Hard Coding Wildcard for Search

    Any updates? where you able to resolve this?

  5. #5
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Hard Coding Wildcard for Search

    Check out include/SearchForm/SearchForm2.php and look around line 751 for the "case 'like'" area. You can add the wild card before and after the search string:

    PHP Code:
                                case 'like':
                                    if(
    $type == 'bool' && $field_value == 0) {
                                        
    $where .=  $db_field " = '0' OR " $db_field " IS NULL";
                                    }
                                    else {
                                        
    $where .=  $db_field " like '%".$field_value.$like_char."%'";
                                    }
                                    break; 
    BTW - This isn't upgrade safe and will be lost on any upgrades so if you do this make sure to mark the code so that you can find any not-upgrade-safe code in the future. It'll save you many headaches!

  6. #6
    pucky900 is offline Junior Member
    Join Date
    May 2008
    Posts
    2

    Default Re: Hard Coding Wildcard for Search

    You are the Sugar Hero... didn't think it would be that easy. Works perfectly. Much Thanks!

  7. #7
    swiety79 is offline Junior Member
    Join Date
    Aug 2011
    Posts
    1

    Default Re: Hard Coding Wildcard for Search

    Thanks eggsurplus! It works just great!

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. how to change hard coding
    By velocity00723 in forum Developer Help
    Replies: 7
    Last Post: 2009-01-14, 03:27 AM
  2. Using wildcard in a workflow rule
    By yoggiecrm in forum General Discussion
    Replies: 2
    Last Post: 2008-08-19, 10:11 PM
  3. Wildcard character
    By wjohnson in forum Feature Requests
    Replies: 0
    Last Post: 2008-02-05, 10:30 PM
  4. UnifiedSearch wildcard
    By brob in forum General Discussion
    Replies: 12
    Last Post: 2006-11-19, 05:20 PM
  5. force sugar to do a Wildcard search in 4.2.1b
    By audiopleb in forum Developer Help
    Replies: 3
    Last Post: 2006-08-24, 12:00 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
  •