Is it possible to search by a date range for the leads module? As far as I can tell it appears the only way to search is based on a specific date.
Is it possible to search by a date range for the leads module? As far as I can tell it appears the only way to search is based on a specific date.
To change by a date range you need to:
1. Create a new class which extends the default Lead class;
2. Create a custom controller for Leads and implement the method action_listview;
3. Inside this method you need to override the attribute $this->bean as an instance of the new class;
4. Implement into new Lead class the method create_new_list_query to override the array $ret_array according to your needs. This method is defined into data/SugarBean.php
5. Create an extended vardefs for Leads to add two non-db date fields;
6. Add these two new fields into searchdefs.php
7. Modify the create_new_list_query into new Lead class to consider the sql query based on the two fields;
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.
Alternatively you can use the lucene integration I posted on Sugarforge http://www.sugarforge.org/projects/kinamulucene/ and search for leads (include object_name:Lead in the search and then the resp date field ... the link to the lucene search syntax will tell you how to search for date ranges.
In addition you can also add any other query you might want in that ...
... christian.
PS: you will only need to make sure that the respective date field get's indexed by the search engine.
Sounds good, thanks for the replies.
I've run into a snag using Andopes's Date Range solution above. Any suggestions?
http://www.sugarcrm.com/forums/showthread.php?p=237511
Hi,
I think there is a mistake in the regex. The pattern does not match the WHERE clause for all the situations, according to the order the fields are organized. I could make this customization working by using the following regex. It's working for me in all the situations :
Hope this could help help someone in the future.PHP Code:$ret_array['where'] = preg_replace('/\(\s?leads\.create_start_date[^)]+\)/', '1', $ret_array['where']);
$ret_array['where'] = preg_replace('/\(\s?leads\.create_end_date[^)]+\)/', '1', $ret_array['where']);
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks