Skip to content
Snippets Groups Projects
Commit 3a88e331 authored by lobo's avatar lobo
Browse files

CRM-13665 - Make upgrade fault tolerant for merging activity contacts

parent 52df1987
No related branches found
No related tags found
No related merge requests found
...@@ -133,7 +133,7 @@ class CRM_Upgrade_Incremental_php_FourFour { ...@@ -133,7 +133,7 @@ class CRM_Upgrade_Incremental_php_FourFour {
2 => array('Fattorini Name Badge 100x65', 'String'), 2 => array('Fattorini Name Badge 100x65', 'String'),
3 => array('Hanging Badge 3-3/4" x 4-3"/4', 'String'), 3 => array('Hanging Badge 3-3/4" x 4-3"/4', 'String'),
); );
foreach ($insertStatements as $values) { foreach ($insertStatements as $values) {
$query = 'INSERT INTO civicrm_option_value (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES' . $values; $query = 'INSERT INTO civicrm_option_value (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`) VALUES' . $values;
CRM_Core_DAO::executeQuery($query, $queryParams); CRM_Core_DAO::executeQuery($query, $queryParams);
...@@ -193,6 +193,10 @@ VALUES ...@@ -193,6 +193,10 @@ VALUES
$dao = CRM_Core_DAO::executeQuery($query); $dao = CRM_Core_DAO::executeQuery($query);
} }
// sometimes an user does not make a clean backup and the above table
// already exists, so lets delete this table - CRM-13665
$query = "DROP TABLE civicrm_activity_contact";
$dao = CRM_Core_DAO::executeQuery($query);
$query = " $query = "
CREATE TABLE IF NOT EXISTS civicrm_activity_contact ( CREATE TABLE IF NOT EXISTS civicrm_activity_contact (
...@@ -208,6 +212,7 @@ CREATE TABLE IF NOT EXISTS civicrm_activity_contact ( ...@@ -208,6 +212,7 @@ CREATE TABLE IF NOT EXISTS civicrm_activity_contact (
$dao = CRM_Core_DAO::executeQuery($query); $dao = CRM_Core_DAO::executeQuery($query);
$query = " $query = "
INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id) INSERT INTO civicrm_activity_contact (activity_id, contact_id, record_type_id)
SELECT activity_id, target_contact_id, {$targetID} as record_type_id SELECT activity_id, target_contact_id, {$targetID} as record_type_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment