CRM-17410: Using xml on upgrade (not installation) of extension to create/append...
authorjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Thu, 1 Dec 2016 13:19:45 +0000 (18:49 +0530)
committerjitendrapurohit <jitendra.purohit@webaccessglobal.com>
Wed, 14 Dec 2016 09:50:52 +0000 (15:20 +0530)
CRM/Utils/Migrate/Import.php

index 927f82385c6a4f5b502379043dc930ba7f13c171..912e5f1b8bfda3657bfc5d11b9a61c34aa47c290 100644 (file)
@@ -155,6 +155,10 @@ class CRM_Utils_Migrate_Import {
       foreach ($optionValuesXML->OptionValue as $optionValueXML) {
         $optionValue = new CRM_Core_DAO_OptionValue();
         $optionValue->option_group_id = $idMap['option_group'][(string ) $optionValueXML->option_group_name];
+        if (empty($optionValue->option_group_id)) {
+          //CRM-17410 check if option group already exist.
+          $optionValue->option_group_id = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', $optionValueXML->option_group_name, 'id', 'name');
+        }
         $this->copyData($optionValue, $optionValueXML, FALSE, 'label');
         if (!isset($optionValue->value)) {
           $sql = "