Merge pull request #4054 from eileenmcnaughton/CRM-15237
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 3.2.beta4.mysql.tpl
1 -- CRM-6451
2 {if $multilingual}
3 -- add a name column, populate it from the name_xx_YY chosen in
4 ALTER TABLE civicrm_membership_status ADD name VARCHAR(128) COMMENT 'Name for Membership Status';
5 UPDATE civicrm_membership_status SET name = name_{$seedLocale};
6 -- add label_xx_YY columns and populate them from name_xx_YY, dropping the latter
7 {foreach from=$locales item=loc}
8 ALTER TABLE civicrm_membership_status ADD label_{$loc} VARCHAR(128) COMMENT 'Label for Membership Status';
9 UPDATE civicrm_membership_status SET label_{$loc} = name_{$loc};
10 {/foreach}
11 -- drop the column separately.
12 {foreach from=$locales item=loc}
13 ALTER TABLE civicrm_membership_status DROP name_{$loc};
14 {/foreach}
15 {else}
16 -- add a label column and populate it from the name column
17 ALTER TABLE civicrm_membership_status ADD label VARCHAR(128) COMMENT 'Label for Membership Status';
18 UPDATE civicrm_membership_status SET label = name;
19 {/if}
20
21
22 -- CRM-6004
23 {if $multilingual && !$hasLocalizedPreHelpCols}
24 {foreach from=$locales item=loc}
25 ALTER TABLE civicrm_uf_field ADD help_pre_{$loc} text COMMENT 'Description and/or help text to display before this field.';
26 UPDATE civicrm_uf_field SET help_pre_{$loc} = help_pre;
27 {/foreach}
28 ALTER TABLE civicrm_uf_field DROP help_pre;
29 {/if}
30
31 -- CRM-6472
32 DELETE civicrm_uf_field FROM civicrm_uf_field
33 INNER JOIN civicrm_uf_group
34 WHERE civicrm_uf_group.id = civicrm_uf_field.uf_group_id
35 AND civicrm_uf_group.name = 'summary_overlay';
36
37 DELETE civicrm_uf_join FROM civicrm_uf_join
38 INNER JOIN civicrm_uf_group
39 WHERE civicrm_uf_group.id = civicrm_uf_join.uf_group_id
40 AND civicrm_uf_group.name = 'summary_overlay';
41
42 DELETE FROM civicrm_uf_group WHERE name = 'summary_overlay';
43
44 INSERT INTO civicrm_uf_group
45 (name, group_type, {localize field='title'}title{/localize}, is_reserved ) VALUES
46 ('summary_overlay', 'Contact', {localize}'Summary Overlay'{/localize}, 1 );
47
48 SELECT @uf_group_id_summary := max(id) FROM civicrm_uf_group WHERE name = 'summary_overlay';
49
50 INSERT INTO civicrm_uf_join
51 (is_active,module,entity_table,entity_id,weight,uf_group_id) VALUES
52 (1, 'Profile', NULL, NULL, 6, @uf_group_id_summary );
53
54 INSERT INTO civicrm_uf_field
55 ( uf_group_id, field_name, is_required, is_reserved, weight, visibility, in_selector, is_searchable, location_type_id, {localize field='label'}label{/localize}, field_type) VALUES
56 ( @uf_group_id_summary, 'phone' ,1, 0, 1, 'User and User Admin Only', 0, 0, 1, {localize}'Home Phone'{/localize}, 'Contact' ),
57 ( @uf_group_id_summary, 'phone' ,1, 0, 2, 'User and User Admin Only', 0, 0, 2, {localize}'Home Mobile'{/localize}, 'Contact' ),
58 ( @uf_group_id_summary, 'street_address', 1, 0, 3, 'User and User Admin Only', 0, 0, NULL, {localize}'Primary Address'{/localize}, 'Contact' ),
59 ( @uf_group_id_summary, 'city', 1, 0, 4, 'User and User Admin Only', 0, 0, NULL, {localize}'City'{/localize}, 'Contact' ),
60 ( @uf_group_id_summary, 'state_province', 1, 0, 5, 'User and User Admin Only', 0, 0, NULL, {localize}'State'{/localize}, 'Contact' ),
61 ( @uf_group_id_summary, 'postal_code', 1, 0, 6, 'User and User Admin Only', 0, 0, NULL, {localize}'Postal Code'{/localize}, 'Contact' ),
62 ( @uf_group_id_summary, 'email', 1, 0, 7, 'User and User Admin Only', 0, 0, NULL, {localize}'Primary Email'{/localize}, 'Contact' ),
63 ( @uf_group_id_summary, 'group', 1, 0, 8, 'User and User Admin Only', 0, 0, NULL, {localize}'Groups'{/localize}, 'Contact' ),
64 ( @uf_group_id_summary, 'tag', 1, 0, 9, 'User and User Admin Only', 0, 0, NULL, {localize}'Tags'{/localize}, 'Contact' ),
65 ( @uf_group_id_summary, 'gender', 1, 0, 10, 'User and User Admin Only', 0, 0, NULL, {localize}'Gender'{/localize}, 'Individual' ),
66 ( @uf_group_id_summary, 'birth_date', 1, 0, 11, 'User and User Admin Only', 0, 0, NULL, {localize}'Date of Birth'{/localize}, 'Individual' );