Merge pull request #7518 from jitendrapurohit/CRM-17723
[civicrm-core.git] / CRM / Event / BAO / Event.php
index cd7c33288e0ac714811da06d1e593f0fa9f85691..2ad3f680b15595568f1718266ef41cf8b3ed8428 100644 (file)
@@ -626,11 +626,15 @@ $event_summary_limit
       if ($role) {
         $roleClause = 'IN';
       }
-      $roles = implode(',', array_keys($roleTypes));
-      if (empty($roles)) {
-        $roles = 0;
+
+      if (!empty($roleTypes)) {
+        $escapedRoles = array();
+        foreach (array_keys($roleTypes) as $roleType) {
+          $escapedRoles[] = CRM_Utils_Type::escape($roleType, 'String');
+        }
+
+        $clause[] = "participant.role_id {$roleClause} ( '" . implode("', '", $escapedRoles) . "' ) ";
       }
-      $clause[] = "participant.role_id {$roleClause} ( $roles )";
     }
 
     $sqlClause = '';
@@ -1660,9 +1664,8 @@ WHERE  id = $cfID
                 //take the custom field options
                 $returnProperties = array($name => 1);
                 $query = new CRM_Contact_BAO_Query($params, $returnProperties, $fields);
-                $options = &$query->_options;
                 if (!$skip) {
-                  $displayValue = CRM_Core_BAO_CustomField::getDisplayValue($customVal, $cfID, $options);
+                  $displayValue = CRM_Core_BAO_CustomField::displayValue($customVal, $cfID);
                 }
                 //Hack since we dont have function to check empty.
                 //FIXME in 2.3 using crmIsEmptyArray()