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

UpdateGreeting script - Handle setting values for contacts who do not have greetings and addressee values set

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.1.3
    • Fix Version/s: 3.1.4
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      Background
      =========
      Currently, the UpdateGreeting.php script provides two options:
      1. Default behavior: Script updates specified greeting type for specified contact type for all contacts where greeting_id / address_id is NOT null. It apparently re-sets all greeting_id OR address_id values for these contacts - to the default greeting_id OR to an ID value passed into the script

      2. Force=1 behavior: Same as above, but all contacts of the specified type are updated to the default or passed greeting/address ID.

      The option to set greeting and addressee values and cached display for contacts who DO NOT have these values set is missing. This is especially important because contacts are created NULL *_greeting_id and addressee_id set when created via Profile (standalone or embedded in Contribution page / event registration).

      http://forum.civicrm.org/index.php/topic,12483.0.html

      It also seems wrong for the script to reset the ID value to the default for contacts who already have an ID value set.

      Implementation
      ============
      1. Default behavior (when force= parameter is not passed):
      1.1 For contacts w/ greeting/address_id set - IF _display column is NULL (cached value), then set it based on _id value. Do NOT update greeting/addressee_id values when they are already set.

      1.2 For contacts w/ NULL greeting/address id - SET _id and _display cached value) columns using passed ID or default for that greeting/addressee type and contact type.

      2. force=1 behavior:
      2.1 Update greeting/address_id (specified gt=) for ALL contacts of the specified contact type using passed ID or default. (This is same as existing behavior.)

      3. force=2 behavior
      This mode is primarily intended for setting cached greeting/address values (_display column) for contacts created during IMPORT (since users can import a greeting_id and addressee_id, but we don't set the _display column values during import. Force=2 ONLY updates contacts that already have a greeting/address_id set.

      3.1 If no ID is included in params (for greeting/addressee_id), then we update cached value on existing ID and only for contacts that have an ID.

      3.2 if an ID is included in params (for greeting/addressee_id) - then update all contacts that alerady have an _id value set (for the specified greeting type) to the passed ID. AND set the cached value (_display column) based on that ID.

        Attachments

          Activity

            People

            • Assignee:
              kiran.jagtap Kiran Jagtap
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: