From ff15d3285aa36344f6987a54f5ac47aa0dd15c71 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 21 Oct 2020 11:56:52 +1300 Subject: [PATCH] Enable contribution cancel actions Once completed this extension will be unhidden and available to disable --- CRM/Upgrade/Incremental/php/FiveThirtyTwo.php | 33 +++++++++++++++++++ xml/templates/civicrm_data.tpl | 1 + 2 files changed, 34 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FiveThirtyTwo.php b/CRM/Upgrade/Incremental/php/FiveThirtyTwo.php index 890695e34a..14e1412333 100644 --- a/CRM/Upgrade/Incremental/php/FiveThirtyTwo.php +++ b/CRM/Upgrade/Incremental/php/FiveThirtyTwo.php @@ -47,6 +47,38 @@ class CRM_Upgrade_Incremental_php_FiveThirtyTwo extends CRM_Upgrade_Incremental_ // } } + /** + * Install contributioncancelactions extension. + * + * This feature is restructured as a core extension - which is primarily a code cleanup step but + * also permits sites / extensions to disable the core actions to do their own workflows. + * + * @param \CRM_Queue_TaskContext $ctx + * + * @return bool + * + * @throws \CRM_Core_Exception + */ + public static function installContributionCancelActions(CRM_Queue_TaskContext $ctx) { + // Install via direct SQL manipulation. Note that: + // (1) This extension has no activation logic. + // (2) On new installs, the extension is activated purely via default SQL INSERT. + // (3) Caches are flushed at the end of the upgrade. + // ($) Over long term, upgrade steps are more reliable in SQL. API/BAO sometimes don't work mid-upgrade. + $insert = CRM_Utils_SQL_Insert::into('civicrm_extension')->row([ + 'type' => 'module', + 'full_name' => 'contributioncancelactions', + 'name' => 'contributioncancelactions', + 'label' => 'Contribution cancel actions', + 'file' => 'contributioncancelactions', + 'schema_version' => NULL, + 'is_active' => 1, + ]); + CRM_Core_DAO::executeQuery($insert->usingReplace()->toSQL()); + + return TRUE; + } + /** * Upgrade function. * @@ -57,6 +89,7 @@ class CRM_Upgrade_Incremental_php_FiveThirtyTwo extends CRM_Upgrade_Incremental_ $this->addTask('Add column civicrm_saved_search.name', 'addColumn', 'civicrm_saved_search', 'name', "varchar(255) DEFAULT NULL COMMENT 'Unique name of saved search'"); $this->addTask('Add column civicrm_saved_search.label', 'addColumn', 'civicrm_saved_search', 'label', "varchar(255) DEFAULT NULL COMMENT 'Administrative label for search'"); $this->addTask('Add index civicrm_saved_search.UI_name', 'addIndex', 'civicrm_saved_search', 'name', 'UI'); + $this->addTask('Install contribution cancel actions extension', 'installContributionCancelActions'); } } diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index e86bd1e584..50a26abd2b 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -1782,3 +1782,4 @@ INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_act INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'greenwich', 'Theme: Greenwich', 'Theme: Greenwich', 'greenwich', 1); INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'eventcart', 'Event cart', 'Event cart', 'eventcart', 1); INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'financialacls', 'Financial ACLs', 'Financial ACLs', 'financialacls', 1); +INSERT IGNORE INTO civicrm_extension (type, full_name, name, label, file, is_active) VALUES ('module', 'contributioncancelactions', 'Contribution cancel actions', 'Contribution cancel actions', 'contributioncancelactions', 1); -- 2.25.1