Skip to content

Commit

Permalink
CRM-14786 - CaseType - Perform reconciliation whenever a case-type de…
Browse files Browse the repository at this point in the history
…finition changes
  • Loading branch information
totten committed Jun 28, 2014
1 parent 81a8a2e commit 9c19292
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CRM/Case/BAO/CaseType.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ static function add(&$params) {
// 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);
Expand Down
14 changes: 14 additions & 0 deletions CRM/Core/ManagedEntities.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ public static function singleton($fresh = FALSE) {
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
Expand Down

0 comments on commit 9c19292

Please sign in to comment.