Results 1 to 5 of 5

Thread: Multienum search revisited

  1. #1
    kenneth.thorman is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    191

    Default Multienum search revisited

    Multi enum search on custom module does not seem to work I looked at the source code include/SearchForm/SearchForm2.php
    and find this

    Code:
    if($GLOBALS['db']->dbType != 'mysql' && !empty($this->seed->field_name_map[$field]['isMultiSelect']) && 
    $this->seed->field_name_map[$field]['isMultiSelect']) { 
                            // construct the query for multenums
                            // use the 'like' query for all mssql and oracle examples as both custom and OOB multienums are implemented with types that cannot be used with an 'in'
                            $operator = 'custom_enum';
                            $table_name = $this->seed->table_name ;
                            if ($customField)
                                $table_name .= "_cstm" ;
                            $db_field = $table_name . "." . $field;
                            
    	                    foreach($parms['value'] as $key => $val) {
    
    	                        if($val != ' ' and $val != '') {
    	                               $qVal = $GLOBALS['db']->quote($val);
    	                               if (!empty($field_value)) {
    	                                   $field_value .= ' or ';
    	                               }
    	                               $field_value .= "$db_field like '$qVal' or $db_field like '%$qVal^%' or $db_field like '%^$qVal%' or $db_field like '%^$qVal^%'";
    	                        }                            
    	                    }
    there is even a comment regarding using the like syntax but only on Oracle and MSSQL.

    I tried changing the top line to this

    if(!empty($this->seed->field_name_map[$field]['isMultiSelect']) && $this->seed->field_name_map[$field]['isMultiSelect']) {

    and now it seems to work. What is it I am missing here, it seems way to obvious to be a bug? Why has this been commented out for mysql?

    Anyone?

    Regards
    Kenneth Thorman

  2. #2
    SugarDev.net is offline Sugar Community Member
    Join Date
    Feb 2008
    Posts
    1,401

    Default Re: Multienum search revisited

    Quote Originally Posted by kenneth.thorman
    it seems way to obvious to be a bug?
    I'm not going to say anything here .



    Thnx for the submission, I hope this gets any attention!
    Developers go here
    Businesses go there (Dutch)

    Modules:
    SugarDev.net Developer Tools | Config | Dutch Language Pack
    "Nothing gets fixed unless there is a bug"

  3. #3
    kenneth.thorman is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    191

    Default Re: Multienum search revisited

    LOL

    Well it seems like there should be something that have caused them to write that much extra code to handle mysql as a special case and have all the logic in place to handle it on Oracle and MSSQL?

    Clint/Julian any comments?

    Regards
    Ken

  4. #4
    lougaou's Avatar
    lougaou is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Lyon - France
    Posts
    236

    Default Re: Multienum search revisited

    Weird weird....
    --------------------
    Xavier Rigal

  5. #5
    lougaou's Avatar
    lougaou is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Lyon - France
    Posts
    236

    Default Re: Multienum search revisited

    In 5.1.0 they have commented this part:

    /*$GLOBALS['db']->dbType != 'mysql' &&*/
    --------------------
    Xavier Rigal

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Enhanced Search Plugin
    By kenshiro in forum Downloads
    Replies: 71
    Last Post: 2010-08-24, 02:45 PM
  2. Replies: 6
    Last Post: 2007-11-22, 01:31 PM
  3. Edit the basic Search form
    By vincentd401 in forum Developer Help
    Replies: 2
    Last Post: 2007-09-27, 10:09 AM
  4. BUG In Search/Edit Layout???
    By tj@estreet.com in forum Help
    Replies: 13
    Last Post: 2006-06-10, 05:43 AM

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
  •