From 0dc36ab0871eaf42c8e85c7750b2acdc165c96ad Mon Sep 17 00:00:00 2001 From: eileen Date: Sun, 26 May 2019 17:38:37 +1200 Subject: [PATCH] dev/core#905 Separate contribution_recur status_id option group from contribution option group As we did earlier for pledge status this separates out the option groups - on the basis we have different statuses for the 2 things. In order to ensure we don't break anything existing the values we give the new option group the exact same values as the old one> However, I HAVE added one more value - Processing - which is intended for the period between when a new contribution starts to be added and when it has been added. This would normally be a few seconds but when there is an error it would be left in this state - warding off future attempts. For new sites I have left off some statuses that I think would not be relevant - Refunded, Partially Paid, Chargeback, Pending Refund --- CRM/Contribute/DAO/ContributionRecur.php | 6 +++--- CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl | 10 ++++++++++ xml/schema/Contribute/ContributionRecur.xml | 2 +- xml/templates/civicrm_data.tpl | 11 +++++++++++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 3b5fcb2f66..dfc0899bc5 100644 --- a/CRM/Contribute/DAO/ContributionRecur.php +++ b/CRM/Contribute/DAO/ContributionRecur.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionRecur.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:02897f2c575bc43e915d0b7e8ee68fbb) + * (GenCodeChecksum:1efdc763e4b5337f0dc4f9f13bd2d719) */ /** @@ -550,8 +550,8 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'type' => 'Select', ], 'pseudoconstant' => [ - 'optionGroupName' => 'contribution_status', - 'optionEditPath' => 'civicrm/admin/options/contribution_status', + 'optionGroupName' => 'contribution_recur_status', + 'optionEditPath' => 'civicrm/admin/options/contribution_recur_status', ], ], 'is_test' => [ diff --git a/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl index 88322517c3..72f20ba635 100644 --- a/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl +++ b/CRM/Upgrade/Incremental/sql/5.15.alpha1.mysql.tpl @@ -1 +1,11 @@ {* file to handle db changes in 5.15.alpha1 during upgrade *} +--dev/core#905 Add contribution recur status option group +INSERT INTO `civicrm_option_group` ( `name`, {localize field='title'}`title`{/localize}, `is_active`, `is_reserved`, `is_locked` ) VALUES ('contribution_recur_status', {localize}'{ts escape="sql"}Recurring Contribution Status{/ts}'{/localize}, 1, 1, 1); + +SELECT @option_group_id_ps := MAX(id) FROM `civicrm_option_group` where name = 'contribution_recur_status'; + +INSERT INTO `civicrm_option_value` (`option_group_id`, {localize field='label'}`label`{/localize}, `value`, `name`, `weight`, `is_reserved`, `is_active`, `is_default`) +SELECT @option_group_id_ps as option_group_id, {localize field='label'}`label`{/localize}, value, ov.name, weight, ov.is_reserved, ov.is_active, is_default +FROM civicrm_option_value ov +INNER JOIN civicrm_option_group og +ON og.id = ov.option_group_id AND og.name = 'contribution_status'; diff --git a/xml/schema/Contribute/ContributionRecur.xml b/xml/schema/Contribute/ContributionRecur.xml index 1e3a211e07..97bc37c35d 100644 --- a/xml/schema/Contribute/ContributionRecur.xml +++ b/xml/schema/Contribute/ContributionRecur.xml @@ -241,7 +241,7 @@ true 1.6 - contribution_status + contribution_recur_status Select diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 7407884c1b..7a3058127b 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -212,6 +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), + ('contribution_recur_status' , '{ts escape="sql"}Recurring Contribution Status{/ts}' , NULL, 1, 1, 1), ('environment' , '{ts escape="sql"}Environment{/ts}' , NULL, 1, 1, 0), ('activity_default_assignee' , '{ts escape="sql"}Activity default assignee{/ts}' , NULL, 1, 1, 0); @@ -294,6 +295,7 @@ SELECT @option_group_id_contactDateMode := max(id) from civicrm_option_group whe SELECT @option_group_id_date_filter := max(id) from civicrm_option_group where name = 'relative_date_filters'; SELECT @option_group_id_wysiwyg_presets := max(id) from civicrm_option_group where name = 'wysiwyg_presets'; SELECT @option_group_id_ps := max(id) from civicrm_option_group where name = 'pledge_status'; +SELECT @option_group_id_crs := max(id) from civicrm_option_group where name = 'contribution_recur_status'; SELECT @option_group_id_env := max(id) from civicrm_option_group where name = 'environment'; SELECT @option_group_id_default_assignee := max(id) from civicrm_option_group where name = 'activity_default_assignee'; @@ -1044,6 +1046,15 @@ VALUES (@option_group_id_ps, '{ts escape="sql"}In Progress{/ts}', 5, 'In Progress', NULL, 0, NULL, 4, NULL, 0, 1, 1, NULL, NULL, NULL), (@option_group_id_ps, '{ts escape="sql"}Overdue{/ts}' , 6, 'Overdue' , NULL, 0, NULL, 5, NULL, 0, 1, 1, NULL, NULL, NULL), + +-- Contribution Recur Status + (@option_group_id_crs, '{ts escape="sql"}Completed{/ts}' , 1, 'Completed' , NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_crs, '{ts escape="sql"}Pending{/ts}' , 2, 'Pending' , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_crs, '{ts escape="sql"}Cancelled{/ts}' , 3, 'Cancelled' , NULL, 0, NULL, 3, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_crs, '{ts escape="sql"}Failed{/ts}' , 4, 'Failed' , NULL, 0, NULL, 4, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_crs, '{ts escape="sql"}In Progress{/ts}', 5, 'In Progress', NULL, 0, NULL, 5, NULL, 0, 1, 1, NULL, NULL, NULL), + (@option_group_id_crs, '{ts escape="sql"}Overdue{/ts}' , 6, 'Overdue' , NULL, 0, NULL, 6, NULL, 0, 1, 1, NULL, NULL, NULL); + -- CiviCase - Activity Assignee Default -- (`option_group_id`, `label`, `value`, `name`, `grouping`, `filter`, `is_default`, `weight`, `description`, `is_optgroup`, `is_reserved`, `is_active`, `component_id`, `visibility_id`, `icon`) (@option_group_id_default_assignee, '{ts escape="sql"}None{/ts}', '1', 'NONE', NULL, 0, 1, 1, NULL, 0, 0, 1, NULL, NULL, NULL), -- 2.25.1