CRM-14578 - Add upgrade logic and incorporate FK fix for location_type_id
authorDave Greenberg <dave@civicrm.org>
Sat, 21 Feb 2015 01:42:26 +0000 (17:42 -0800)
committerDave Greenberg <dave@civicrm.org>
Sat, 21 Feb 2015 01:42:26 +0000 (17:42 -0800)
----------------------------------------
* CRM-14578: Relocate Advanced Date Input Settings to Customize data and screens menu
  https://issues.civicrm.org/jira/browse/CRM-14578

CRM/Upgrade/Incremental/sql/4.6.beta1.mysql.tpl

index ed9505bfc458e1e1e7f93d96d78458219b7ef89b..9ba5f49f4bed1e11cf63b54a6ccfff3814498619 100644 (file)
@@ -1,4 +1,15 @@
 {* file to handle db changes in 4.6.beta1 during upgrade *}
 -- See https://issues.civicrm.org/jira/browse/CRM-15361
+UPDATE civicrm_mailing SET location_type_id = NULL WHERE location_type_id = 0;
 ALTER TABLE civicrm_mailing ADD CONSTRAINT FK_civicrm_mailing_location_type_id FOREIGN KEY FK_civicrm_mailing_location_type_id(`location_type_id`) REFERENCES `civicrm_location_type`(`id`) ON DELETE SET NULL;
 
+SELECT @parent_id := id from `civicrm_navigation` where name = 'Customize Data and Screens' AND domain_id = {$domainID};
+SELECT @add_weight_id := weight from `civicrm_navigation` where `name` = 'Search Preferences' and `parent_id` = @parent_id;
+UPDATE `civicrm_navigation`
+SET `weight` = `weight`+1
+WHERE `parent_id` = @parent_id
+AND `weight` > @add_weight_id;
+INSERT INTO `civicrm_navigation`
+( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
+VALUES
+( {$domainID}, 'civicrm/admin/setting/preferences/date?reset=1', '{ts escape="sql" skip="true"}Date Preferences{/ts}', 'Date Preferences', 'administer CiviCRM', '', @parent_id , '1', NULL, @add_weight_id + 1 );