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

printing labels for members without address (+ FIX)

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.9, 4.7.10
    • Fix Version/s: 4.7.11
    • Component/s: CiviMember
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      If trying to print address labels for a group of members (via the Search menu), if there's 1 member without address no PDF is generated.
      The error reported (the offset "3" mentioned is the contact id):

      [Mon Aug 08 11:59:26.034306 2016] [:error] [pid 9347] [client 127.0.0.1:35388] PHP Notice: Undefined offset: 3 in /var/www/html/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Member/Form/Task/Label.php on line 137, referer: http://localhost/wordpress/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fmember%2Fsearch&_qf_Label_display=true&qfKey=0641e9fcfaf46572ba2663d356f59a9c_6506

      The reason seems to be this part in CRM/Member/Form/Task/Label.php (line 135-138):

            foreach ($memberships['values'] as $id => $membership) {
              $labelRows[$id] = $rows[$membership['contact_id']];
            }
      

      The $rows variable only contains entries for members that actually have an address, so changing this to:

            foreach ($memberships['values'] as $id => $membership) {
              if (isset($rows[$membership['contact_id']]))
                 $labelRows[$id] = $rows[$membership['contact_id']];
            }
      

      should do the trick.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              liedekef Franky Van Liedekerke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: