Merge pull request #19232 from eileenmcnaughton/friend
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 4.6.9.mysql.tpl
1 {* file to handle db changes in 4.6.9 during upgrade *}
2
3 -- CRM-17112 - Add Missing countries Saint Barthélemy and Saint Martin
4 INSERT INTO civicrm_country (name,iso_code,region_id,is_province_abbreviated) VALUES("Saint Barthélemy", "BL", "2", "0");
5 INSERT INTO civicrm_country (name,iso_code,region_id,is_province_abbreviated) VALUES("Saint Martin (French part)", "MF", "2", "0");
6
7 -- CRM-17039 - Add credit note for cancelled payments
8 {include file='../CRM/Upgrade/4.6.9.msg_template/civicrm_msg_template.tpl'}
9
10 -- CRM-17258 - Add created id, owner_id to report instances.
11 ALTER TABLE civicrm_report_instance
12 ADD COLUMN `created_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to contact table.',
13 ADD COLUMN `owner_id` int(10) unsigned DEFAULT NULL COMMENT 'FK to contact table.',
14 ADD CONSTRAINT `FK_civicrm_report_instance_created_id` FOREIGN KEY (`created_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL,
15 ADD CONSTRAINT `FK_civicrm_report_instance_owner_id` FOREIGN KEY (`owner_id`) REFERENCES `civicrm_contact` (`id`) ON DELETE SET NULL;
16
17 -- CRM-16907
18 SELECT @navMaxWeight := MAX(ROUND(weight)) from civicrm_navigation WHERE parent_id IS NULL;
19
20 -- Add "support" menu if it's not there already
21 INSERT INTO civicrm_navigation (domain_id, label, name, is_active, weight)
22 SELECT * FROM (SELECT {$domainID} as domain_id, 'Support' as label, 'Help' as name, 1 as is_active, @navMaxWeight + 1 as weight) AS tmp
23 WHERE NOT EXISTS (
24 SELECT name FROM civicrm_navigation WHERE name = 'Help' AND domain_id = {$domainID}
25 ) LIMIT 1;
26
27 SELECT @adminHelplastID := id FROM civicrm_navigation WHERE name = 'Help' AND domain_id = {$domainID};
28
29 UPDATE civicrm_navigation
30 SET name = 'Support', label = '{ts escape="sql" skip="true"}Support{/ts}'
31 WHERE id = @adminHelplastID;
32
33 DELETE FROM civicrm_navigation where parent_id = @adminHelplastID AND (name = 'Developer' OR url LIKE "http://civicrm.org%");
34
35 INSERT INTO civicrm_navigation
36 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
37 VALUES
38 ( {$domainID}, 'https://civicrm.org/get-started?src=iam', '{ts escape="sql" skip="true"}Get started{/ts}', 'Get started', NULL, 'AND', @adminHelplastID, '1', NULL, 1 ),
39 ( {$domainID}, 'https://civicrm.org/documentation?src=iam', '{ts escape="sql" skip="true"}Documentation{/ts}', 'Documentation', NULL, 'AND', @adminHelplastID, '1', NULL, 2 ),
40 ( {$domainID}, 'https://civicrm.org/ask-a-question?src=iam', '{ts escape="sql" skip="true"}Ask a question{/ts}', 'Ask a question', NULL, 'AND', @adminHelplastID, '1', NULL, 3 ),
41 ( {$domainID}, 'https://civicrm.org/experts?src=iam', '{ts escape="sql" skip="true"}Get expert help{/ts}', 'Get expert help', NULL, 'AND', @adminHelplastID, '1', NULL, 4 ),
42 ( {$domainID}, 'https://civicrm.org/about?src=iam', '{ts escape="sql" skip="true"}About CiviCRM{/ts}', 'About CiviCRM', NULL, 'AND', @adminHelplastID, '1', 1, 5 ),
43 ( {$domainID}, 'https://civicrm.org/register-your-site?src=iam&sid={ldelim}sid{rdelim}', '{ts escape="sql" skip="true"}Register your site{/ts}', 'Register your site', NULL, 'AND', @adminHelplastID, '1', NULL, 6 ),
44 ( {$domainID}, 'https://civicrm.org/become-a-member?src=iam&sid={ldelim}sid{rdelim}', '{ts escape="sql" skip="true"}Join CiviCRM{/ts}', 'Join CiviCRM', NULL, 'AND', @adminHelplastID, '1', NULL, 7 );
45
46 INSERT INTO civicrm_navigation
47 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
48 VALUES
49 ( {$domainID}, NULL, '{ts escape="sql" skip="true"}Developer{/ts}', 'Developer', 'administer CiviCRM', '', @adminHelplastID, '1', 1, 8 );
50
51 SET @devellastID:=LAST_INSERT_ID();
52 INSERT INTO civicrm_navigation
53 ( domain_id, url, label, name, permission, permission_operator, parent_id, is_active, has_separator, weight )
54 VALUES
55 ( {$domainID}, 'civicrm/api', '{ts escape="sql" skip="true"}API Explorer{/ts}','API Explorer', 'administer CiviCRM', '', @devellastID, '1', NULL, 1 ),
56 ( {$domainID}, 'https://civicrm.org/developer-documentation?src=iam', '{ts escape="sql" skip="true"}Developer Docs{/ts}', 'Developer Docs', 'administer CiviCRM', '', @devellastID, '1', NULL, 3 );
57
58 -- Set CiviCRM URLs to https
59 UPDATE civicrm_navigation SET url = REPLACE(url, 'http://civicrm.org', 'https://civicrm.org');