Results 1 to 8 of 8

Thread: Date range fields under the advanced search panel

  1. #1
    mathewp is offline Member
    Join Date
    Feb 2009
    Posts
    5

    Default Date range fields under the advanced search panel

    I need to know how to put 2 input text fields under the advanced search panel in the Leads page. One will be called Start Date and the other one will be called End Date. All records from the lead table whose date_entered field fall in the range between Start Date and End Date will be displayed under results.

    Thanks in advance,

    Mathew P

  2. #2
    genius786's Avatar
    genius786 is offline Sugar Community Member
    Join Date
    Nov 2008
    Location
    Karachi, Pakistan
    Posts
    129

    Smile Re: Date range fields under the advanced search panel

    Hi Mathew,

    You have to use Studio which exists in admin panel. After opening Studio go to the leads folder then click on Layouts -> Search and select advance search where you put the field you want either the field is custom created field or already created field.



    Best regards,
    SARFARAZ AHMED KHAN
    Karachi, Pakistan
    skype: genius_crystal
    genius_crystal@hotmail.com
    92-314-2595624

  3. #3
    mathewp is offline Member
    Join Date
    Feb 2009
    Posts
    5

    Default Re: Date range fields under the advanced search panel

    Thanks for your help... Putting the fields in place isn't the problem. I need to find a way to get date from start_date and end_date fields and get all the records that fall in that range.
    I want mysql to run the following query:

    SELECT * from sugarcrm.leads
    where date_entered
    BETWEEN start_date AND end_date;

  4. #4
    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: Date range fields under the advanced search panel

    Quote Originally Posted by mathewp View Post
    Thanks for your help... Putting the fields in place isn't the problem. I need to find a way to get date from start_date and end_date fields and get all the records that fall in that range.
    I want mysql to run the following query:

    SELECT * from sugarcrm.leads
    where date_entered
    BETWEEN start_date AND end_date;
    Hi Mathew

    You need to create a custom controller for your module (custom/<ModuleName>/controller.php) containing the method action_listview.
    Inside this method you need to override the $this->bean as an instance of a new class which extends the default module class.
    Inside that module class you need to implement the method create_new_list_query.
    This method is defined in the data/SugarBean.php.

    Take a look at this two piece of code:

    controller:
    PHP Code:
    <?PHP
    require_once('include/MVC/Controller/SugarController.php');
    require_once(
    'modules/Opportunities/OpportunityInListView.php');

    class 
    OpportunitiesController extends SugarController {
        function 
    action_listview() {
            
    $this->view_object_map['bean'] = $this->bean;
            
    $this->view 'list';
            
    $GLOBALS['view'] = $this->view;
            
    $this->bean = new OpportunityInListView();
        }
    }
    ?>
    new class:
    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    class 
    OpportunityInListView extends Opportunity {

        function 
    Opportunity() {
            
    parent::Opportunity();
        }
        
        function 
    create_new_list_query($order_by$where,$filter=array(),$params=array(), $show_deleted 0,$join_type=''$return_array false,$parentbean$singleSelect false){
            
    $ret_array parent::create_new_list_query($order_by$where,$filter,$params$show_deleted,$join_type$return_array,$parentbean$singleSelect);
            
    $ret_array['select'] .= ", accounts.name account_name, jtl0.account_id account_id, jtl1.name agency_name, jtl2.name advertiser_name ";
            
    $ret_array['from'] .= "
    LEFT JOIN  accounts_opportunities jtl0 ON opportunities.id=jtl0.opportunity_id  AND jtl0.deleted=0 
    LEFT JOIN  accounts accounts ON accounts.id=jtl0.account_id AND accounts.deleted=0 AND accounts.deleted=0 
    LEFT JOIN  accounts jtl1 ON opportunities.agency_id=jtl1.id AND jtl1.deleted=0 
    LEFT JOIN  accounts jtl2 ON opportunities.advertiser_id=jtl2.id AND jtl2.deleted=0"
    ;

            
    $ret_array['where'] = str_replace("opportunities.agency_name""jtl1.name"$ret_array['where']);
            
    $ret_array['where'] = str_replace("opportunities.advertiser_name""jtl2.name"$ret_array['where']);

            return 
    $ret_array;
        }
    }
    ?>
    Kind regards
    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.

  5. #5
    malcolmh's Avatar
    malcolmh is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Aug 2004
    Posts
    1,712

    Default Re: Date range fields under the advanced search panel

    Hi,

    Maybe this is what you are looking for http://www.sugarforge.org/projects/enhancedsearch/
    Cheers Malcolm

    Genius4U Limited - Ingenious simple IT solutions for you / Genial einfache IT Lösungen für Sie
    http://www.genius4u.com or http://www.genius4u.de

  6. #6
    rhoerbe is offline Junior Member
    Join Date
    Dec 2008
    Posts
    2

    Default Is teh demo support to work

    I installed enhanced searchin my CE-installation, and tried advanced search. However, when I endered date ranges it did not retrieve any data, although it should. OR and NOT did not restrict the query in any way.

  7. #7
    rhoerbe is offline Junior Member
    Join Date
    Dec 2008
    Posts
    2

    Default Re: Date range fields under the advanced search panel

    The demo seems to be limited to the user interface, need commercial version.

  8. #8
    kenshiro is offline Sugar Community Member
    Join Date
    Mar 2007
    Location
    Macerata - ITALY
    Posts
    421

    Default Re: Date range fields under the advanced search panel

    Quote Originally Posted by rhoerbe View Post
    The demo seems to be limited to the user interface, need commercial version.
    No, the DEMO is not limitied to the user interface.
    The difference between the DEMO and the FULL is that the usage of some operators is not extended to all search type fields.
    The reason of this problem is a bug related to the php error level configuration, that will be fixed in the next Enhanced Search release.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 6
    Last Post: 2008-09-12, 06:25 PM
  2. Replies: 5
    Last Post: 2008-03-03, 04:45 AM
  3. Advanced Search Panel
    By boratti in forum Feature Requests
    Replies: 3
    Last Post: 2008-01-03, 08:38 PM
  4. Replies: 1
    Last Post: 2006-06-16, 03:35 AM
  5. New fields on Contacts advanced search
    By TheShark in forum Developer Help
    Replies: 6
    Last Post: 2006-06-13, 08:07 AM

Tags for this Thread

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
  •