From b95507abc45a375dc3c138b4f1c013a6293be929 Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 23 Apr 2013 10:46:44 +0530 Subject: [PATCH] CRM-12274 --- CRM/Upgrade/Incremental/php/FourFour.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/CRM/Upgrade/Incremental/php/FourFour.php b/CRM/Upgrade/Incremental/php/FourFour.php index 8aa873b6bc..6c9f6a2690 100644 --- a/CRM/Upgrade/Incremental/php/FourFour.php +++ b/CRM/Upgrade/Incremental/php/FourFour.php @@ -80,18 +80,31 @@ class CRM_Upgrade_Incremental_php_FourFour { $upgrade = new CRM_Upgrade_Form(); $activityContacts = CRM_Core_PseudoConstant::activityContacts('name'); - $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); - $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); - $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); + $ovValue[] = $sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts); + $ovValue[] = $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts); + $ovValue[] = $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts); $optionGroupID = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionGroup', 'activity_contacts', 'id', 'name'); + if (!empty($ovValue)) { + $ovValues = implode(', ', $ovValue); + $query = " +UPDATE civicrm_option_value +SET is_reserved = 1 +WHERE option_group_id = {$optionGroupID} AND value IN ($ovValues)"; + + $dao = CRM_Core_DAO::executeQuery($query); + } + if (!$assigneeID) { + $assigneeID = 1; $value[] = "({$optionGroupID}, 'Activity Assignees', 1, 'Activity Assignees', 1, 1, 1)"; } if (!$sourceID) { + $sourceID = 2; $value[] = "({$optionGroupID}, 'Activity Source', 2, 'Activity Source', 2, 1, 1)"; } if (!$targetID) { + $targetID = 3; $value[] = "({$optionGroupID}, 'Activity Targets', 3, 'Activity Targets', 3, 1, 1)"; } -- 2.25.1