CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • mail to household ids - what are allowed values?
Pages: [1]

Author Topic: mail to household ids - what are allowed values?  (Read 965 times)

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
mail to household ids - what are allowed values?
March 26, 2008, 04:53:56 pm
Doing a mailout cleanup today, I noticed that we have many (1700+) contacts with mail_to_household_id = 0, and one or two whose mail_to_household_id is not a valid contact id (presumably a deleted household).

We haven't noticed any issues arising from this, but I figured it might help to seek clarification.

1. Is there a difference between mail_to_household_id = 0 and mail_to_household_id IS NULL ?
2. Should there be some rule to ensure that if a household is deleted, the corresponding contacts with mail_to_household_id = $household['contact_id'] are updated?
3. In a perfect setup, should I get zero results for this?

Code: [Select]
SELECT mail_to_household_id FROM civicrm_contact
WHERE mail_to_household_id IS NOT NULL
AND mail_to_household_id NOT IN ( SELECT id FROM civicrm_contact ) ;
@xurizaemon ● www.fuzion.co.nz

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: mail to household ids - what are allowed values?
March 26, 2008, 05:46:44 pm

1. i dont think there is a difference between 0 and null (there is a sql difference, but to some extent it depends on the query u use). Ideally those values if not set should be null. I think it might be our DB layer which gives it a nice integer value of 0 :(

2. i just added a constraint for that in 2.1

3. yes, you might also want to skip if mail_to_household_id = 0

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: mail to household ids - what are allowed values?
March 26, 2008, 05:58:53 pm
Hi - are we having two parallel discussions here http://forum.civicrm.org/index.php/topic,2824
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • mail to household ids - what are allowed values?

This forum was archived on 2017-11-26.