From 24f4fd7751d3b380d3b990429cf18de4d0f02125 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Thu, 1 Dec 2016 18:49:45 +0530 Subject: [PATCH] CRM-17410: Using xml on upgrade (not installation) of extension to create/append new optionvalues --- CRM/Utils/Migrate/Import.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CRM/Utils/Migrate/Import.php b/CRM/Utils/Migrate/Import.php index 927f82385c..912e5f1b8b 100644 --- a/CRM/Utils/Migrate/Import.php +++ b/CRM/Utils/Migrate/Import.php @@ -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 = " -- 2.25.1