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

Mailing Label code calls hooks for tokens, but does not apply them to the label

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.2.8, 2.2.9, 3.0
    • Fix Version/s: 3.1
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      The action "Generate Mailing labels" calls the hooks "hook_civicrm_tokens" and "hook_civicrm_tokenValues". But the values for the custom hooks are never placed on the mailing label.

      I have also changed the "global settings" for address so the mailing label format is specified as:

      {contact.joint_greeting} {contact.addressee} {contact.street_address} {contact.supplemental_address_1} {contact.supplemental_address_2} {contact.city} {, } {contact.state_province}

      { }

      {contact.postal_code} {contact.country}

      But when I generate my mailing labels, the new token ( in my case "contact.joint_greeting" is ignored.

      I added print statements to the file "CRM/Contact/Form/Task/Label.php" so I can verify that my hooks are getting called.

      I was testing the code
      --------------------------------------------------------------------
      else {
      $found = false;

      // we should replace all the tokens that are set in mailing label format
      foreach ( $mailingFormatProperties as $key => $dontCare ) {
      if ( CRM_Utils_Array::value( $key, $contact ) )

      { $found = true; break; }

      }
      ------------------------------
      and observed that the variable "$mailingFormatProperties" has my token as just "joint_greeting" . It also seems to be looking for the data to fill the label from the $contact variable, not the array returned from the hook.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              sgladstone Sarah Gladstone
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: