Merge pull request #5473 from aydun/CRM-16160
[civicrm-core.git] / api / v3 / Event.php
index 3050081a74db06458c77df3751062c993c6b557d..4728270b45361f3c8dcc16dd2cae943839d67647 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -259,8 +259,12 @@ function _civicrm_api3_event_getlist_output($result, $request) {
       if (!empty($row['summary'])) {
         $data['description'][] = $row['summary'];
       }
-      foreach ($request['extra'] as $field) {
-        $data['extra'][$field] = isset($row[$field]) ? $row[$field] : NULL;
+      // Add repeating info
+      $repeat = CRM_Core_BAO_RecurringEntity::getPositionAndCount($row['id'], 'civicrm_event');
+      $data['extra']['is_recur'] = FALSE;
+      if ($repeat) {
+        $data['suffix'] = ts('(%1 of %2)', array(1 => $repeat[0], 2 => $repeat[1]));
+        $data['extra']['is_recur'] = TRUE;
       }
       $output[] = $data;
     }