Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-08-16-18-06-10
[civicrm-core.git] / CRM / Badge / BAO / Badge.php
index 21972d54938408c97f8f8c52e0c1b2a594982401..cab4afddb6cfc3595a971610b57bae5a6d146a52 100644 (file)
@@ -26,7 +26,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -75,7 +75,7 @@ class CRM_Badge_BAO_Badge {
   }
 
   /**
-   * Funtion to create structure and add meta data according to layout.
+   * Function to create structure and add meta data according to layout.
    *
    * @param array $row
    *   Row element that needs to be formatted.
@@ -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;
       }
     }