From: Tim Otten Date: Sat, 28 Jun 2014 03:37:16 +0000 (-0700) Subject: CRM-14786 - CaseType - Perform reconciliation whenever a case-type definition changes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=9c19292b47fdfab36542769d40c322e0d463b87c;p=civicrm-core.git CRM-14786 - CaseType - Perform reconciliation whenever a case-type definition changes --- diff --git a/CRM/Case/BAO/CaseType.php b/CRM/Case/BAO/CaseType.php index 00e0547e97..ae5daeeddc 100644 --- a/CRM/Case/BAO/CaseType.php +++ b/CRM/Case/BAO/CaseType.php @@ -74,6 +74,7 @@ class CRM_Case_BAO_CaseType extends CRM_Case_DAO_CaseType { // function to format definition column if (isset($params['definition']) && is_array($params['definition'])) { $params['definition'] = self::convertDefinitionToXML($params['name'], $params['definition']); + CRM_Core_ManagedEntities::scheduleReconcilation(); } $caseTypeDAO->copyValues($params); diff --git a/CRM/Core/ManagedEntities.php b/CRM/Core/ManagedEntities.php index 52141b2f86..10a7ff36f2 100644 --- a/CRM/Core/ManagedEntities.php +++ b/CRM/Core/ManagedEntities.php @@ -36,6 +36,20 @@ class CRM_Core_ManagedEntities { return $singleton; } + /** + * Perform an asynchronous reconciliation when the transaction ends. + */ + public static function scheduleReconcilation() { + CRM_Core_Transaction::addCallback( + CRM_Core_Transaction::PHASE_POST_COMMIT, + function () { + CRM_Core_ManagedEntities::singleton(TRUE)->reconcile(); + }, + array(), + 'ManagedEntities::reconcile' + ); + } + /** * @param array $modules CRM_Core_Module * @param array $declarations per hook_civicrm_managed