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 »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail only selects 'organization' type contacts, no 'individual'
Pages: [1]

Author Topic: civimail only selects 'organization' type contacts, no 'individual'  (Read 1054 times)

bslash

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.4.3
  • CMS version: drupal 7
  • MySQL version: 5.1.63
  • PHP version: 5.3.3
civimail only selects 'organization' type contacts, no 'individual'
January 02, 2014, 11:04:02 am
working on a fresh civicrm 4.4.3, on drupal 7. (our old installation could not be upgraded anymore, so I decided to start fresh, and import the old contacts. That works fine, until this weird issue).

When I create groups, I can add both organisations and individuals to it. When I then want to send a scheduled mail to that group, the 'expected recipients' only show the 'organisation' type contacts, and none of the individuals.

The log in sites/default/files/civicrm/ConfigAndLog show no errors.

Does anybody have a clue where I should be looking?

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: civimail only selects 'organization' type contacts, no 'individual'
January 02, 2014, 08:49:06 pm

I would compare the contact record and email record of an individual and organization and see what the differences are in the common fields

seems like the individuals have been marked as do not mail / opt out / is deceased or something like that

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

bslash

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.4.3
  • CMS version: drupal 7
  • MySQL version: 5.1.63
  • PHP version: 5.3.3
Re: civimail only selects 'organization' type contacts, no 'individual'
January 04, 2014, 08:15:11 am
Mystery solved: Zombie holocaust ;-)

for future reference: my imports had left individuals which were not marked explicitly with 'is_deceased' values with a value of NULL.

Now, not knowing whether someone is deceased or not is not good, kids...

For CiviMail to send out mails, it specifically wants that value to be 0. A quick UPDATE civicrm_contact SET `is_deceased`='0' WHERE (`contact_type`="Individual" AND `is_deceased` IS NULL) fixed it. Zombiecalypse averted!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: civimail only selects 'organization' type contacts, no 'individual'
January 04, 2014, 03:05:33 pm
This could be a problem in your DB - I looked at that table (on a 4.4.4 install) & the field has a default value of 0 (although I suspect the field should also be a 'NOT NULL' field which it is not & there is a possibility the civicrm code is incorrectly setting it to null rather than letting the DB default it to 0
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

bslash

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.4.3
  • CMS version: drupal 7
  • MySQL version: 5.1.63
  • PHP version: 5.3.3
Re: civimail only selects 'organization' type contacts, no 'individual'
January 04, 2014, 03:43:21 pm
well, the import function definitely sets it to "Null" rather than "0" if you import CSV files where 'is_deceased' is not one of the columns to be imported. Haven't looked at the import routine in code, but it could be good to review it so it sets default values instead of "null" for non-defined columns in the import.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: civimail only selects 'organization' type contacts, no 'individual'
January 04, 2014, 03:47:13 pm
If you do

SHOW CREATE TABLE civicrm_contact

You should get something like

CREATE TABLE `civicrm_contact` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique Contact ID',
  `nick_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Nick Name.',
  `legal_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `contact_type` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Type of Contact',
  `do_not_email` tinyint(4) DEFAULT '0',
  `do_not_phone` tinyint(4) DEFAULT '0',
  `do_not_mail` tinyint(4) DEFAULT '0',
  `do_not_sms` tinyint(4) DEFAULT '0',
  `contact_sub_type` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'May be used to over-ride contact view and edit templates.',
  `legal_identifier` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'May be used for SSN, EIN/TIN, Household ID (census) or other applicable unique legal/government ID.',
  `external_identifier` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Unique trusted external ID (generally from a legacy app/datasource). Particularly useful for deduping operations.',
  `sort_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Name used for sorting different contact types',
  `display_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Formatted name representing preferred format for display/print/other output.',
  `image_URL` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Optional URL for preferred image (photo, logo, etc.) to display for this contact',
  `preferred_communication_method` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'What is the preferred mode of communication.',
  `preferred_mail_format` enum('Text','HTML','Both') COLLATE utf8_unicode_ci DEFAULT 'Both' COMMENT 'What is the preferred mode of sending an email.',
  `do_not_trade` tinyint(4) DEFAULT '0',
  `hash` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Key for validating requests related to this contact.',
  `is_opt_out` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'Has the contact opted out from receiving all bulk email from the organization or site domain?',
  `source` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'where domain_id contact come from, e.g. import, donate module insert...',
  `first_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `middle_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `last_name` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `prefix_id` int(10) unsigned DEFAULT NULL,
  `suffix_id` int(10) unsigned DEFAULT NULL,
  `email_greeting_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_option_value.id, that has to be valid registered Email Greeting.',
  `email_greeting_custom` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Custom Email Greeting.',
  `email_greeting_display` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Cache Email greeting.',
  `postal_greeting_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_option_value.id, that has to be valid registered Postal Greeting.',
  `postal_greeting_custom` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Custom Postal greeting.',
  `postal_greeting_display` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Cache Postal  greeting.',
  `addressee_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to civicrm_option_value.id, that has to be valid registered Addressee.',
  `addressee_custom` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Custom Addressee.',
  `addressee_display` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Cache Addressee.',
  `job_title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `gender_id` int(10) unsigned DEFAULT NULL,
  `birth_date` date DEFAULT NULL,
  `is_deceased` tinyint(4) DEFAULT '0',
  `deceased_date` date DEFAULT NULL,
  `household_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `primary_contact_id` int(10) unsigned DEFAULT NULL,
  `organization_name` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL,
  `sic_code` varchar(8) COLLATE utf8_unicode_ci DEFAULT NULL,
  `user_unique_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `employer_id` int(10) unsigned DEFAULT NULL,
  `api_key` varchar(32) COLLATE utf8_unicode_ci DEFAULT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `preferred_language` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Which language is preferred for communication. FK to languages in civicrm_option_value.',
  `created_date` timestamp NULL DEFAULT NULL COMMENT 'When was the contact was created.',
  `modified_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'When was the contact (or closely related entity) was created or modified or deleted.',
  PRIMARY KEY (`id`),
  UNIQUE KEY `UI_external_identifier` (`external_identifier`),
  KEY `index_preferred_communication_method` (`preferred_communication_method`),
  KEY `index_first_name` (`first_name`),
  KEY `index_last_name` (`last_name`),
  KEY `UI_prefix` (`prefix_id`),
  KEY `UI_suffix` (`suffix_id`),
  KEY `UI_gender` (`gender_id`),
  KEY `index_household_name` (`household_name`),
  KEY `index_organization_name` (`organization_name`),
  KEY `FK_civicrm_contact_primary_contact_id` (`primary_contact_id`),
  KEY `index_contact_type` (`contact_type`),
  KEY `index_contact_sub_type` (`contact_sub_type`),
  KEY `index_sort_name` (`sort_name`),
  KEY `index_hash` (`hash`),
  KEY `FK_civicrm_contact_employer_id` (`employer_id`),
  KEY `index_api_key` (`api_key`),
  KEY `dedupe_index_birth_date` (`birth_date`),
  KEY `index_is_deleted_sort_name` (`is_deleted`,`sort_name`,`id`),
  CONSTRAINT `FK_civicrm_contact_employer_id` FOREIGN KEY (`employer_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL,
  CONSTRAINT `FK_civicrm_contact_primary_contact_id` FOREIGN KEY (`primary_contact_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=54038 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci

Is the default for 'is_deceased' 0 ? in not you should set it to that - otherwise it's likely you could replicate this on the DEMO site & file as a bug (it might be worth running an ALTER command in the next upgrade script to ensure it is set to 0 if the problem is it is not set)

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

bslash

  • I’m new here
  • *
  • Posts: 8
  • Karma: 1
  • CiviCRM version: 4.4.3
  • CMS version: drupal 7
  • MySQL version: 5.1.63
  • PHP version: 5.3.3
Re: civimail only selects 'organization' type contacts, no 'individual'
January 05, 2014, 11:47:21 am
if I do "SHOW create", it definitely shows `is_deleted` tinyint(4) NOT NULL DEFAULT '0',

but that notwithstanding, if i import csv files with no value for is_deleted, it still gets set to NULL. Not sure how I can check this at the demo site, you'd need db access to check for those. But have recreated it on various empty, vanilla sites now.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • CiviMail installation and configuration (Moderator: Donald Lobo) »
  • civimail only selects 'organization' type contacts, no 'individual'

This forum was archived on 2017-11-26.