Merge pull request #10360 from yashodha/CRM-20552
[civicrm-core.git] / Civi / CCase / Events.php
index 31b12caf14e082733ced59989510f6f330fb6d4e..557c8c08938160facecae9c338133978d96ec5b3 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2017                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -80,16 +80,20 @@ class Events {
   }
 
   /**
-   * @param $caseId
+   * Fire case change hook
+   *
+   * @param int|array $caseIds
    */
-  public static function fireCaseChangeForRealz($caseId) {
-    if (!isset(self::$isActive[$caseId])) {
-      $tx = new \CRM_Core_Transaction();
-      self::$isActive[$caseId] = 1;
-      $analyzer = new \Civi\CCase\Analyzer($caseId);
-      \CRM_Utils_Hook::caseChange($analyzer);
-      unset(self::$isActive[$caseId]);
-      unset($tx);
+  public static function fireCaseChangeForRealz($caseIds) {
+    foreach ((array) $caseIds as $caseId) {
+      if (!isset(self::$isActive[$caseId])) {
+        $tx = new \CRM_Core_Transaction();
+        self::$isActive[$caseId] = 1;
+        $analyzer = new \Civi\CCase\Analyzer($caseId);
+        \CRM_Utils_Hook::caseChange($analyzer);
+        unset(self::$isActive[$caseId]);
+        unset($tx);
+      }
     }
   }