Custom Date field "range Search" does not show in "Popup Search"

Hello,

I Created a Date Field in the Accounts module called "Founded Date" and marked the "Range Search" property so i could find Accounts in a range of dates.

i added the field to the basic search and the Popup Search.

In the Basic Search i see the range search:

range3.png

But when i get inside Cases module and Create a new case and click on the Accounts relate field,

i see the Date Field without the range search in the Search Popup of Accounts:

range4.png

i read about it online.

i changed the row in file include/sugarFields/Fields/Base/SugarfieldBase.php from this:

return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']) && $_REQUEST['action']!='Popup';

to this

return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']);

So now i see it as ranged search but the date is ignored completely when pushing "Search" !

i choose "Equals to" = 2/3/2016 but it still shows the account with 9/3/2016 value in Founded Date field:

range5.png

how can i make the field take part of the search?

please help!

Using Sugarcrm CE 6.5.13

  • Hi Asaf,

    This is a known defect. However, there is a workaround mentioned in the defect description. To do this, go to line 656 of ./include/SugarFields/Fields/Base/SugarFieldBase.php and change it to this:

    return !empty($vardef['enable_range_search']) && !empty($_REQUEST['action']); // && $_REQUEST['action']!='Popup';
    

    Note that the last portion of the line is now commented out. Run a QRR and this should now be working. It's important to note that this is NOT upgrade-safe. You can try redefining this function in the custom folder to see if the changes would work in an upgrade-safe way. If you try that, let me know the results.

    I hope this helps!

    -Alan

  • Thank you for the response.

    i also tried that already and read the solution here (and even commented on the response):

    http://stackoverflow.com/questions/18738289/date-field-do-not-display-dropdown-in-popup-of-sugarcrm

    it does change the field to be a range search, but when pushing "Search" button the date field is completely ignored.

    like it doesn't exist and still present all records.

    i also changed the post above. i managed to make the date field change to ranged search but in my solution also, the date is ignored completely when searched.

  • Hi Asaf,

    Again, this solution is NOT upgrade-safe and these changes will be lost if/when you upgrade. That said, you can try adding the following at line 295 of include/Popups/PopupSmarty.php:

    if(file_exists('custom/modules/'.$this->module.'/metadata/SearchFields.php')) {
        require('custom/modules/'.$this->module.'/metadata/SearchFields.php');
    }
    

    Let me know if that helps!

    -Alan

  • Yes!!!! it works!!!

    You are a life saver thank you!

    Let me clarify the solution you gave because it took me time to understand where to put the code.

    around line 295, add the above (Alan Reply) code above the code that uses the 'modules/'.$this->module.'/metadata/SearchFields.php' file like this:

    if(file_exists('custom/modules/'.$this->module.'/metadata/SearchFields.php'))

      { 

        require('custom/modules/'.$this->module.'/metadata/SearchFields.php'); 

      } 

      else if(!empty($metafiles[$this->module]['searchfields'])) {

      require($metafiles[$this->module]['searchfields']);

      } elseif(file_exists('modules/'.$this->module.'/metadata/SearchFields.php')) {

      require('modules/'.$this->module.'/metadata/SearchFields.php');

         }