Merge pull request #4054 from eileenmcnaughton/CRM-15237
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 3.4.beta3.mysql.tpl
1
2 -- CRM-7871
3 INSERT INTO civicrm_option_group
4 (name, {localize field='description'}description{/localize}, is_reserved, is_active)
5 VALUES
6 ('engagement_index', {localize}'{ts escape="sql"}Engagement Levels{/ts}'{/localize}, 0, 1);
7
8 SELECT @optGrpIdEngagementIndex := max(id) from civicrm_option_group where name = 'engagement_index';
9
10 INSERT INTO civicrm_option_value
11 (option_group_id, {localize field='label'}label{/localize}, value, name, grouping, filter, is_default, weight, is_optgroup, is_reserved, is_active, component_id, visibility_id)
12 VALUES
13 (@optGrpIdEngagementIndex, {localize}'{ts escape="sql"}1{/ts}'{/localize}, 1, 1, NULL, 0, NULL, 1, 0, 0, 1, NULL, NULL),
14 (@optGrpIdEngagementIndex, {localize}'{ts escape="sql"}2{/ts}'{/localize}, 2, 2, NULL, 0, NULL, 2, 0, 0, 1, NULL, NULL),
15 (@optGrpIdEngagementIndex, {localize}'{ts escape="sql"}3{/ts}'{/localize}, 3, 3, NULL, 0, NULL, 3, 0, 0, 1, NULL, NULL),
16 (@optGrpIdEngagementIndex, {localize}'{ts escape="sql"}4{/ts}'{/localize}, 4, 4, NULL, 0, NULL, 4, 0, 0, 1, NULL, NULL),
17 (@optGrpIdEngagementIndex, {localize}'{ts escape="sql"}5{/ts}'{/localize}, 5, 5, NULL, 0, NULL, 5, 0, 0, 1, NULL, NULL);
18
19 -- insert navigation link.
20 -- NOTE: code below will not work due to spaces in increment statement for weight
21 -- and because CiviCampaign admin links were not inserted during 3.3 upgrade
22 -- fixing both issues in 3.4.1 upgrade: CRM-7956
23
24 SELECT @civiCampaignNavId := MAX(id) FROM civicrm_navigation where name = 'CiviCampaign';
25 SELECT @cmapaignNavMaxWeight := MAX(ROUND(weight)) from civicrm_navigation WHERE parent_id = @civiCampaignNavId;
26
27 INSERT INTO civicrm_navigation
28 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
29 VALUES
30 ( {$domainID}, 'civicrm/admin/options/engagement_index&group=engagement_index&reset=1', '{ts escape="sql"}Engagement Index{/ts}', 'Engagement Index', 'administer CiviCampaign', '', @civiCampaignNavId, 1, NULL, @cmapaignNavMaxWeight + 1 );
31