Friday, January 8, 2016

[sugarcrm] Add today, tomorrow and yesterday into date range search drowdown

If you want to add 3 items (today, tomorrow and yesterday) into date range search dropdown on search field.
We need to modify some things
Step 1: if en_us.lang.php don't exist, you need to create new file en_us.lang.php and save it at custom\include\language\ then you add 3 items

$GLOBALS['app_list_strings']['date_range_search_dom']=array (
    '=' => 'Equals',
    'today' => 'Today',
    'yesterday' => 'Yesterday',
    'tomorrow' => 'Tomorrow',

    'not_equal' => 'Not On',
    'greater_than' => 'After',
    'less_than' => 'Before',
    'last_7_days' => 'Last 7 Days',
    'next_7_days' => 'Next 7 Days',
    'last_30_days' => 'Last 30 Days',
    'next_30_days' => 'Next 30 Days',
    'last_month' => 'Last Month',
    'this_month' => 'This Month',
    'next_month' => 'Next Month',
    'last_year' => 'Last Year',
    'this_year' => 'This Year',
    'next_year' => 'Next Year',
    'between' => 'Is Between',
  );




Step 2: Copy SearchForm2.php file from \include\SearchForm\ to custom\include\SearchForm.
Then you go to line 1154(case 'next_year':) then add new code.
case 'next_year':
case 'yesterday':
case 'today':
case 'tomorrow': 


Step 3: Open include\MVC\View\views\ view.list.php file then go to line 216. You need to replace old  to new script.

// tanphuqn begin to comment this code for run custom search form on 31/12/2015
//require_once('include/SearchForm/SearchForm2.php');
require_once('custom/include/SearchForm/SearchForm2.php');
// tanphuqn end31/12/2015


This my result:

No comments: