Results 1 to 5 of 5

Thread: Contacts search query has "where" clause with wrong data

  1. #1
    danti is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default Contacts search query has "where" clause with wrong data

    Hi all,

    SugarCRM 6.1GA here, having an issue with the SQL query on the Contacts advanced search.

    I have the email opt out parameters set to a number of contacts and it is important that it stays like that
    (having to deal with german customers, email opt out is a legal requirement).
    Now when I run a search, looks like the SQL query is constructed with this WHERE clause:

    AND ( contacts.email_opt_out like '1%'))

    Since the SugarCRM instance was migrated from v4.5, the opt out values for the contacts are either "off" or "on", while it seems to me that now the query searches for "0" and "1" respectively.

    How (and especially where) can I change the query to reflect the actual values in the db?
    or do I have to update the values in the db?

    thanks,
    A.

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Contacts search query has "where" clause with wrong data

    It sounds like a one time data fix is needed.

    update contacts set email_opt_out = 1 where email_opt_out = 'on';
    update contacts set email_opt_out = 0 where email_opt_out = 'off';

  3. #3
    danti is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default Re: Contacts search query has "where" clause with wrong data

    @eggsurplus

    thanks for the reply.
    So your suggestion is to update the values in the table...
    If the intention is to be "upgrade safe" then I am ok with it.

    a.

  4. #4
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Contacts search query has "where" clause with wrong data

    Yes, suggestion is to update the db because it sounds like this is due to the upgrade not altering the off/on to 0/1 for you.

  5. #5
    danti is offline Junior Member
    Join Date
    Sep 2011
    Posts
    6

    Default Re: Contacts search query has "where" clause with wrong data

    @eggsurplus
    thanks a lot for your help

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. At WHERE clause to a unified search field
    By pauly51 in forum Developer Help
    Replies: 0
    Last Post: 2010-11-01, 08:34 PM
  2. Whats wrong with this SQL Server Query?
    By anicolais in forum Help
    Replies: 9
    Last Post: 2010-02-11, 06:40 AM
  3. Whats wrong with this query
    By chrislynch8 in forum Help
    Replies: 1
    Last Post: 2010-02-02, 11:28 AM
  4. Replies: 6
    Last Post: 2009-07-21, 12:45 PM
  5. Replies: 2
    Last Post: 2009-03-17, 01:34 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
  •