From ac7a239e2050ecd8e7b48ed43138be046b073de0 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 2 Apr 2019 10:39:21 +1300 Subject: [PATCH] Add cancel_reason field --- CRM/Contribute/DAO/ContributionRecur.php | 22 ++++++++++++++++- CRM/Upgrade/Incremental/php/FiveThirteen.php | 26 ++++++++------------ xml/schema/Contribute/ContributionRecur.xml | 12 +++++++++ 3 files changed, 43 insertions(+), 17 deletions(-) diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index c87f48afa0e2..e4642341d8cf 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:e69f645ae471e887f56e95ee10a8678d) + * (GenCodeChecksum:2ccc42487b9e4e5774fcfcde7db9c5ae) */ /** @@ -105,6 +105,13 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { */ public $cancel_date; + /** + * Free text field for a reason for cancelling + * + * @var text + */ + public $cancel_reason; + /** * Date this recurring contribution finished successfully * @@ -427,6 +434,19 @@ public static function &fields() { 'formatType' => 'activityDate', ], ], + 'contribution_recur_cancel_reason' => [ + 'name' => 'cancel_reason', + 'type' => CRM_Utils_Type::T_TEXT, + 'title' => ts('Cancellation Reason'), + 'description' => ts('Free text field for a reason for cancelling'), + 'table_name' => 'civicrm_contribution_recur', + 'entity' => 'ContributionRecur', + 'bao' => 'CRM_Contribute_BAO_ContributionRecur', + 'localizable' => 0, + 'html' => [ + 'type' => 'Text', + ], + ], 'end_date' => [ 'name' => 'end_date', 'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME, diff --git a/CRM/Upgrade/Incremental/php/FiveThirteen.php b/CRM/Upgrade/Incremental/php/FiveThirteen.php index 81dc3c42fae6..d3c74f06a5f7 100644 --- a/CRM/Upgrade/Incremental/php/FiveThirteen.php +++ b/CRM/Upgrade/Incremental/php/FiveThirteen.php @@ -68,21 +68,15 @@ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) { * (change the x in the function name): */ - // /** - // * Upgrade function. - // * - // * @param string $rev - // */ - // public function upgrade_5_0_x($rev) { - // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev); - // $this->addTask('Do the foo change', 'taskFoo', ...); - // // Additional tasks here... - // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex. - // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable. - // } - - // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) { - // return TRUE; - // } + /** + * Upgrade function. + * + * @param string $rev + */ + public function upgrade_5_13_alpha1($rev) { + $this->addTask('Add cancel reason column to civicrm_contribution_recur', 'addColumn', + 'civicrm_contribution_recur', 'cancel_reason', "text COMMENT 'Free text field for a reason for cancelling'", FALSE + ); + } } diff --git a/xml/schema/Contribute/ContributionRecur.xml b/xml/schema/Contribute/ContributionRecur.xml index 9e9145cf8a72..b492bd945305 100644 --- a/xml/schema/Contribute/ContributionRecur.xml +++ b/xml/schema/Contribute/ContributionRecur.xml @@ -147,6 +147,18 @@ activityDate + + cancel_reason + text + Cancellation Reason + contribution_recur_cancel_reason + Free text field for a reason for cancelling + + Text + 40 + + 5.13 + end_date Recurring Contribution End Date