Skip to content

Commit

Permalink
Fix is_reserved flag on option groups
Browse files Browse the repository at this point in the history
  • Loading branch information
mattwire committed Jul 11, 2018
1 parent c0fce6b commit 56196ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CRM/Upgrade/Incremental/sql/5.5.alpha1.mysql.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ ALTER TABLE civicrm_option_group MODIFY COLUMN is_locked TINYINT(4) NOT NULL DE
#is_reserved already has a default so is effectively required but let's be explicit.
UPDATE civicrm_option_group SET `is_reserved` = 0 WHERE `is_reserved` IS NULL;
ALTER TABLE civicrm_option_group MODIFY COLUMN `is_reserved` tinyint(4) NOT NULL DEFAULT 1 COMMENT 'Is this a predefined system option group (i.e. it can not be deleted)?';

#https://lab.civicrm.org/dev/core/issues/155
{* Fix is_reserved flag on civicrm_option_group table *}
UPDATE civicrm_option_group AS cog INNER JOIN civicrm_custom_field AS ccf
ON cog.id = ccf.option_group_id
SET cog.is_reserved = 0 WHERE cog.is_active = 1 AND ccf.is_active = 1;
UPDATE civicrm_option_group SET is_reserved = 1 WHERE name='environment';
2 changes: 1 addition & 1 deletion xml/templates/civicrm_data.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ VALUES
('wysiwyg_presets' , '{ts escape="sql"}WYSIWYG Editor Presets{/ts}' , NULL, 1, 1, 0),
('relative_date_filters' , '{ts escape="sql"}Relative Date Filters{/ts}' , NULL, 1, 1, 0),
('pledge_status' , '{ts escape="sql"}Pledge Status{/ts}' , NULL, 1, 1, 1),
('environment' , '{ts escape="sql"}Environment{/ts}' , NULL, 0, 1, 0);
('environment' , '{ts escape="sql"}Environment{/ts}' , NULL, 1, 1, 0);

SELECT @option_group_id_pcm := max(id) from civicrm_option_group where name = 'preferred_communication_method';
SELECT @option_group_id_act := max(id) from civicrm_option_group where name = 'activity_type';
Expand Down

0 comments on commit 56196ac

Please sign in to comment.