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

Greeting and Address tokens not properly rendered when exporting related contacts from a contrbution search.

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.4
    • Fix Version/s: 4.6.5
    • Component/s: CiviContribute
    • Labels:
      None
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      I duplicated this on the demo site. Search for all contributions from an organization, export them and select a related contact individual's addressee or greeting. The non-rendered token is exported. It looks like the loop in the related contacts part of the CRM/Export/BAO/Export.php has a misplaced bracket.

      diff --git a/all/civicrm/CRM/Export/BAO/Export.php b/all/civicrm/CRM/Export/BAO/Export.php
      index 86b697a..9d690d8 100644
      --- a/all/civicrm/CRM/Export/BAO/Export.php
      +++ b/all/civicrm/CRM/Export/BAO/Export.php
      @@ -914,17 +914,17 @@ INSERT INTO {$componentTable} SELECT distinct gc.contact_id FROM civicrm_group_c
                       elseif ($relationField == 'provider_id') {
                         $fieldValue = CRM_Utils_Array::value($relationValue, $imProviders);
                       }
      -              }
      -              // CRM-13995
      -              elseif (is_object($relDAO) && in_array($relationField, array(
      -                  'email_greeting',
      -                  'postal_greeting',
      -                  'addressee',
      -                ))
      -              ) {
      -                //special case for greeting replacement
      -                $fldValue = "{$relationField}_display";
      -                $fieldValue = $relDAO->$fldValue;
      +                // CRM-13995
      +                elseif (is_object($relDAO) && in_array($relationField, array(
      +                    'email_greeting',
      +                    'postal_greeting',
      +                    'addressee',
      +                  ))
      +                ) {
      +                  //special case for greeting replacement
      +                  $fldValue = "{$relationField}_display";
      +                  $fieldValue = $relDAO->$fldValue;
      +                }
                     }
                     elseif (is_object($relDAO) && $relationField == 'state_province') {
                       $fieldValue = CRM_Core_PseudoConstant::stateProvinceAbbreviation($relDAO->state_province_id);
      

      Pretty easy fix. I can submit a PR through github if that's easier.

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              jlacey Joseph Lacey
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: