Merge pull request #19435 from civicrm/5.34
[civicrm-core.git] / CRM / Upgrade / Incremental / sql / 4.7.9.mysql.tpl
1 {* file to handle db changes in 4.7.9 during upgrade *}
2
3 -- CRM-17607 Change PDF activity type label
4 SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
5 UPDATE civicrm_option_value SET
6 {localize field="label"}label = '{ts escape="sql"}Print/Merge Document{/ts}'{/localize},
7 {localize field="description"}description = '{ts escape="sql"}Export letters and other printable documents.{/ts}'{/localize}
8 WHERE name = 'Print PDF Letter' AND option_group_id = @option_group_id_act;
9
10 -- CRM-18699 Fix Wake Island misspelling, was Wake Ialand
11 UPDATE civicrm_state_province SET name="Wake Island" WHERE name="Wake Ialand";
12
13 -- CRM-18960 Change title in Getting Started widget
14 UPDATE civicrm_dashboard SET
15 {localize field="label"}label = '{ts escape="sql"}CiviCRM Resources{/ts}'{/localize}
16 WHERE name = 'getting-started';
17
18 -- CRM-16189
19 ALTER TABLE civicrm_financial_account
20 ADD `opening_balance` decimal(20,2) DEFAULT '0.00' COMMENT 'Contains the opening balance for this financial account',
21 ADD `current_period_opening_balance` decimal(20,2) DEFAULT '0.00' COMMENT 'Contains the opening balance for the current period for this financial account';
22
23 ALTER TABLE civicrm_contribution
24 ADD `revenue_recognition_date` datetime DEFAULT NULL COMMENT 'Stores the date when revenue should be recognized.';
25
26 -- CRM-16189 Financial account relationship
27 SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
28 SELECT @option_group_id_arel_wt := MAX(weight) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel;
29 SELECT @option_group_id_arel_val := MAX(CAST( `value` AS UNSIGNED )) FROM civicrm_option_value WHERE option_group_id = @option_group_id_arel;
30
31 INSERT INTO
32 `civicrm_option_value` (`option_group_id`, {localize field='label'}label{/localize}, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, {localize field='description'}`description`{/localize}, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`)
33 VALUES
34 (@option_group_id_arel, {localize}'{ts escape="sql"}Deferred Revenue Account is{/ts}'{/localize}, @option_group_id_arel_val+1, 'Deferred Revenue Account is', NULL, 0, 0, @option_group_id_arel_wt+1, {localize}'{ts escape="sql"}Deferred Revenue Account is{/ts}'{/localize}, 0, 1, 1, 2, NULL);
35
36 SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
37 SELECT @opLiability := value FROM civicrm_option_value WHERE name = 'Liability' and option_group_id = @option_group_id_fat;
38 SELECT @domainContactId := contact_id from civicrm_domain where id = {$domainID};
39 INSERT IGNORE INTO
40 `civicrm_financial_account` (`name`, `contact_id`, `financial_account_type_id`, `description`, `accounting_code`, `account_type_code`, `is_reserved`, `is_active`, `is_deductible`, `is_default`)
41 VALUES
42 ('Deferred Revenue - Event Fee', @domainContactId, @opLiability, 'Event revenue to be recognized in future months when the events occur', '2730', 'OCLIAB', 0, 1, 0, 0),
43 ('Deferred Revenue - Member Dues', @domainContactId, @opLiability, 'Membership revenue to be recognized in future months', '2740', 'OCLIAB', 0, 1, 0, 0);
44