CRM-16271 - Fix formatting of custom fields on name badges
authorColeman Watts <coleman@civicrm.org>
Fri, 10 Apr 2015 20:20:34 +0000 (16:20 -0400)
committerColeman Watts <coleman@civicrm.org>
Fri, 10 Apr 2015 20:20:34 +0000 (16:20 -0400)
CRM/Badge/BAO/Badge.php

index bfdc33568a839821579a03162f5e823e78b274c8..90953f956784a17506a2cf16229755f4d9f3c7d7 100644 (file)
@@ -486,7 +486,12 @@ class CRM_Badge_BAO_Badge {
       $query->convertToPseudoNames($dao);
       $rows[$dao->participant_id] = array();
       foreach ($returnProperties as $key => $dontCare) {
-        $rows[$dao->participant_id][$key] = isset($dao->$key) ? $dao->$key : NULL;
+        $value = isset($dao->$key) ? $dao->$key : NULL;
+        // Format custom fields
+        if (strstr($key, 'custom_') && isset($value)) {
+          $value = CRM_Core_BAO_CustomField::getDisplayValue($value, substr($key, 7), $query->_options, $dao->contact_id);
+        }
+        $rows[$dao->participant_id][$key] = $value;
       }
     }