X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=Civi%2FCCase%2FEvents.php;h=472ac9f6471312a7616dcd6dcb7b2fb3f1e85463;hb=26537f4ce77ff8a9a3d27bbe639b136f4e09a4cf;hp=85b633682048d3f337e1540079b776632ad720a4;hpb=4014394ebf74035cc7cc8bee5b37e8057f2c96b2;p=civicrm-core.git diff --git a/Civi/CCase/Events.php b/Civi/CCase/Events.php index 85b6336820..472ac9f647 100644 --- a/Civi/CCase/Events.php +++ b/Civi/CCase/Events.php @@ -55,11 +55,26 @@ class Events { throw new \CRM_Core_Exception("CRM_Case_Listener does not support entity {$event->entity}"); } - if ($caseId && !isset(self::$isActive[$caseId])) { + if ($caseId) { + if (!isset(self::$isActive[$caseId])) { + \CRM_Core_Transaction::addCallback( + \CRM_Core_Transaction::PHASE_POST_COMMIT, + array(__CLASS__, 'fireCaseChangeForRealz'), + array($caseId), + "Civi_CCase_Events::fire::{$caseId}" + ); + } + } + } + + 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); } }