Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17404

NULL values in 'do_not_*' fields if blank in contact:create API

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.9
    • Fix Version/s: None
    • Component/s: CiviMail, Core CiviCRM
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      API calls to 'Contact' 'create' that have blank values for the 'do_not_email' (and similar) fields create a contact in the database with 'NULL' in those fields, eg:

      $result = civicrm_api3('Contact', 'create', array(
      'sequential' => 1,
      'last_name' => "Foo",
      'do_not_email' => "",
      'contact_type' => "Individual",
      ));

      Results in do_not_email being NULL

      These people then do not receive mailings in CiviMail because the code expects to find a 1 or 0 in these fields, but not NULL.

      Proposed solution

      (Enforce these fields to be 1 or 0 in the API?)

      Enforce 'NOT NULL' on the following fields in the civicrm_contact table:
      do_not_email
      do_not_phone
      do_not_mail
      do_not_sms
      do_not_trade

      As per the current configuration of the is_opt_out field.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgg David Greenberg
                Reporter:
                john John K.
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: