CRM-15112 - allow dev to not rebuild triggers when creating custom
authorJamie McClelland <jm@mayfirst.org>
Wed, 13 Aug 2014 21:14:57 +0000 (17:14 -0400)
committerJamie McClelland <jm@mayfirst.org>
Wed, 13 Aug 2014 21:14:57 +0000 (17:14 -0400)
fields via api.

----------------------------------------
* CRM-15112: API create CustomField should expose ability to not rebuild triggers
  https://issues.civicrm.org/jira/browse/CRM-15112

CRM/Core/BAO/CustomField.php

index 4a902f1054e4b9135cc0b9101f06a4b9c3c048cd..4c90b62952c9d0fde46c5c47bb25a743739d6de6 100644 (file)
@@ -285,9 +285,10 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
     // make sure all values are present in the object for further processing
     $customField->find(TRUE);
 
+    $triggerRebuild = CRM_Utils_Array::value('triggerRebuild', $params, TRUE);
     //create/drop the index when we toggle the is_searchable flag
     if (!empty($params['id'])) {
-      self::createField($customField, 'modify', $indexExist);
+      self::createField($customField, 'modify', $indexExist, $triggerRebuild);
     }
     else {
       if (!isset($origParams['column_name'])) {
@@ -299,7 +300,8 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField {
       // make sure all values are present in the object
       $customField->find(TRUE);
 
-      self::createField($customField, 'add');
+      $indexExist = FALSE;
+      self::createField($customField, 'add', $indexExist, $triggerRebuild);
     }
 
     // complete transaction