Results 1 to 5 of 5

Thread: Select * from phones

  1. #1
    cff_moiseszaragoza is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    109

    Default Select * from phones

    I have notice in the last couple of days when i leave the name field empty when i search for a phone # it returns


    Fatal error: SugarBean::require_once() [function.require]: Failed opening required '' (include_path='E:\SugarCRM\include/..;.;C:\php5\pear') in E:\SugarCRM\data\SugarBean.php on line 3323


    if i put anything in there the it may or may not return records

  2. #2
    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: Select * from phones

    Can you kindly attach you SugarBean.php?
    What is your SugarCRM version?

    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.

  3. #3
    cff_moiseszaragoza is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    109

    Default Re: Select * from phones

    This is what you are looking for?


    $sugar_version = '5.5.4';
    $sugar_db_version = '5.5.4';
    $sugar_flavor = 'PRO';
    $sugar_build = '1246';
    $sugar_timestamp = '2010-06-23 06:59am';

  4. #4
    cff_moiseszaragoza is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    109

    Default Re: Select * from phones

    \data\SugarBean.php

    PHP Code:
    function retrieve_parent_fields($type_info)
        {
            
    $queries = array();
            global 
    $beanList$beanFiles;
            
    $templates = array();
            
    $parent_child_map = array();
            foreach(
    $type_info as $children_info)
            {
                foreach(
    $children_info as $child_info)
                {
                    if(
    $child_info['type'] == 'parent')
                    {
                        if(empty(
    $templates[$child_info['parent_type']]))
                        {
                            
    $class $beanList[$child_info['parent_type']];
                            require_once(
    $beanFiles[$class]);
                            
    $templates[$child_info['parent_type']] = new $class();
                        }

                        if(empty(
    $queries[$child_info['parent_type']]))
                        {
                            
    $queries[$child_info['parent_type']] = "SELECT id ";
                            
    $field_def $templates[$child_info['parent_type']]->field_defs['name'];
                            if(isset(
    $field_def['db_concat_fields']))
                            {
                                
    $queries[$child_info['parent_type']] .= ' , ' db_concat($templates[$child_info['parent_type']]->table_name$field_def['db_concat_fields']) . ' parent_name';
                            }
                            else
                            {
                                
    $queries[$child_info['parent_type']] .= ' , name parent_name';
                            }
                            if(isset(
    $templates[$child_info['parent_type']]->field_defs['assigned_user_id']))
                            {
                                
    $queries[$child_info['parent_type']] .= ", assigned_user_id parent_name_owner , '{$child_info['parent_type']}' parent_name_mod";;
                            }else if(isset(
    $templates[$child_info['parent_type']]->field_defs['created_by']))
                            {
                                
    $queries[$child_info['parent_type']] .= ", created_by parent_name_owner, '{$child_info['parent_type']}' parent_name_mod";
                            }
                            
    $queries[$child_info['parent_type']] .= " FROM " $templates[$child_info['parent_type']]->table_name ." WHERE id IN ('{$child_info['parent_id']}'";
                        }
                        else
                        {
                            if(empty(
    $parent_child_map[$child_info['parent_id']]))
                            
    $queries[$child_info['parent_type']] .= " ,'{$child_info['parent_id']}'";
                        }
                        
    $parent_child_map[$child_info['parent_id']][] = $child_info['child_id'];
                    }
                }
            }
            
    $results = array();
            foreach(
    $queries as $query)
            {
                
    $result $this->db->query($query ')');
                while(
    $row $this->db->fetchByAssoc($result))
                {
                    
    $results[$row['id']] = $row;
                }
            }

            
    $child_results = array();
            foreach(
    $parent_child_map as $parent_key=>$parent_child)
            {
                foreach(
    $parent_child as $child)
                {
                    if(isset( 
    $results[$parent_key]))
                    {
                        
    $child_results[$child] = $results[$parent_key];
                    }
                }
            }
            return 
    $child_results;
        }
     
    ?> 

  5. #5
    cff_moiseszaragoza is offline Sugar Community Member
    Join Date
    Jan 2011
    Posts
    109

    Default Re: Select * from phones

    The problem was that there are some recorsds that have NULL in the parent_type instead of a value,
    this is what is causing this problem.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Skypeout For Only Office Phones In Contacts List View?
    By Antonio in forum Feature Requests
    Replies: 4
    Last Post: 2011-01-25, 10:49 AM
  2. Replies: 0
    Last Post: 2010-07-26, 10:32 AM
  3. all phones in one field in listview
    By zaska in forum Help
    Replies: 1
    Last Post: 2009-05-07, 03:33 PM
  4. Custom Search Fields... Phones, Addresses, Etc.
    By jjwdesign in forum Developer Help
    Replies: 2
    Last Post: 2009-04-17, 09:20 PM
  5. Replies: 1
    Last Post: 2008-06-07, 11:10 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
  •