Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-09-05-17-42-45
[civicrm-core.git] / CRM / Event / BAO / Event.php
index 1af2f6c685ebec8d56a1c27312a3d9ce71584112..0753ac83979cf2b427193b81119231f552f8808c 100644 (file)
@@ -275,12 +275,9 @@ FROM   `civicrm_event`
 WHERE  ( civicrm_event.is_template IS NULL OR civicrm_event.is_template = 0 )";
 
     if (!empty($id)) {
-      if (is_array($id)) {
-        $query .= " AND `id` IN (" . implode(',', $id) . ")";
-      }
-      else {
-        $query .= " AND `id` = {$id}";
-      }
+      $op = is_array($id) ? 'IN' : '=';
+      $where = CRM_Contact_BAO_Query::buildClause('id', $op, $id);
+      $query .= " AND {$where}";
     }
     elseif ($all == 0) {
       // find only events ending in the future