Results 1 to 7 of 7

Thread: search ignoring relationship

  1. #1
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default search ignoring relationship

    I have added contact to the case search but it is not working

    To create the field I copied code from Tasks

    My problem is that the sql returned is :

    SELECT cases.id , cases_cstm.*, cases.case_number , cases.name , accounts.name account_name , accounts.assigned_user_id account_name_owner , 'Accounts' account_name_mod, cases.account_id , cases.priority , cases.status , jt1.user_name assigned_user_name , jt1.created_by assigned_user_name_owner , 'Users' assigned_user_name_mod, cases.assigned_user_id FROM cases LEFT JOIN cases_cstm ON cases.id = cases_cstm.id_c LEFT JOIN accounts accounts ON accounts.id= cases.account_id AND accounts.deleted=0 AND accounts.deleted=0 LEFT JOIN users jt1 ON jt1.id= cases.assigned_user_id AND jt1.deleted=0 AND jt1.deleted=0 where ((( contacts.first_name like 'a%' OR contacts.last_name like 'a%' ))) AND cases.deleted=0 ORDER BY cases.case_number DESC

    What is missing is

    LEFT JOIN contacts ON contact_id = contacts.id

    I have built a one-many relationship between contacts & cases and it appears in the relationship table

    Any help in getting this working would be much appreciated

    I have put in a temporary fix by editing include\ListViewData.php and adding a line:
    if ($_REQUEST['module'] = 'Cases') $ret_array['from'] .= ' LEFT JOIN contacts ON contact_id = contacts.id';

    But although it works it is a lousy solution
    Last edited by mikesolomon; 2008-05-14 at 11:55 AM.

  2. #2
    anamikakhadwal's Avatar
    anamikakhadwal is offline Sugar Community Member
    Join Date
    May 2007
    Location
    India
    Posts
    82

    Default Re: search ignoring relationship

    please try this
    By adding this array in vardef


    cases_contacts' => array(
    'name' => 'contacts',
    'type' => 'link',
    'relationship' => 'case_contacts',
    'bean_name' => 'Contact',
    'source' => 'non-db',
    'vname' => 'LBL_CONTACTS',
    ) ,


    hope it will work (not sure )

  3. #3
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: search ignoring relationship

    Quote Originally Posted by anamikakhadwal
    please try this
    By adding this array in vardef


    cases_contacts' => array(
    'name' => 'contacts',
    'type' => 'link',
    'relationship' => 'case_contacts',
    'bean_name' => 'Contact',
    'source' => 'non-db',
    'vname' => 'LBL_CONTACTS',
    ) ,


    hope it will work (not sure )
    No joy I'm afraid

    I already have the following in my vardef

    'contacts' => array(

    'name' => 'contacts',
    'type' => 'link',
    'relationship' => 'contact_mcase',
    'source'=>'non-db',
    'side'=>'right',
    'vname'=>'LBL_CONTACT',
    ),

    I tried yours but didnt work

  4. #4
    anamikakhadwal's Avatar
    anamikakhadwal is offline Sugar Community Member
    Join Date
    May 2007
    Location
    India
    Posts
    82

    Default Re: search ignoring relationship

    Have you repaired "Repair Database" in admin

  5. #5
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: search ignoring relationship

    Quote Originally Posted by anamikakhadwal
    Have you repaired "Repair Database" in admin
    yup did that

    I tend to do it whenever I make a change

  6. #6
    mikesolomon is offline Sugar Community Member
    Join Date
    Feb 2008
    Location
    UK
    Posts
    1,467

    Default Re: search ignoring relationship

    I have now had to remove my one to many relationship as it was interfering with the many-many relationship contacts-cases that already exists

    by doing that and a repair suddenly it is all working

    whether I could recreate it is a totally different question
    Last edited by mikesolomon; 2008-05-14 at 01:40 PM.

  7. #7
    anamikakhadwal's Avatar
    anamikakhadwal is offline Sugar Community Member
    Join Date
    May 2007
    Location
    India
    Posts
    82

    Default Re: search ignoring relationship

    thats gr8!!!!!!!!!!

    cheers

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. upgraded to 4.5.1e, received "Metadata for table tracker does not exist"
    By sfgeorge in forum Installation and Upgrade Help
    Replies: 0
    Last Post: 2007-09-03, 02:24 PM
  2. problemi step 6 di SugarSuite-Full-4.0.1h
    By lucia in forum Italiano
    Replies: 0
    Last Post: 2006-12-27, 08:50 AM
  3. Asterisk Patch 1.1.0 Crash on logon
    By skyracer in forum Help
    Replies: 6
    Last Post: 2006-07-08, 06:30 AM
  4. Replies: 7
    Last Post: 2006-06-06, 07:56 PM
  5. Query erro after 4.0 upgrade
    By ldebernardini in forum Help
    Replies: 20
    Last Post: 2006-01-13, 05:10 PM

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
  •