Skip to content
Snippets Groups Projects
Commit dc396835 authored by ayduns's avatar ayduns
Browse files

Add is_template field to contribution entity

Update tests and examples
parent 109d6845
Branches
Tags
No related merge requests found
......@@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Contribute/Contribution.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:b4e84298d9ba23d3b2fae0768fc5cb58)
* (GenCodeChecksum:a9f83aa612e82ee87ace74e75fe23466)
*/
/**
......@@ -226,6 +226,13 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
*/
public $revenue_recognition_date;
/**
* Shows this is a template for recurring contributions.
*
* @var bool
*/
public $is_template;
/**
* Class constructor.
*/
......@@ -839,6 +846,23 @@ class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
'formatType' => 'activityDateTime',
],
],
'is_template' => [
'name' => 'is_template',
'type' => CRM_Utils_Type::T_BOOLEAN,
'title' => ts('Is a Template Contribution'),
'description' => ts('Shows this is a template for recurring contributions.'),
'import' => TRUE,
'where' => 'civicrm_contribution.is_template',
'export' => TRUE,
'default' => '0',
'table_name' => 'civicrm_contribution',
'entity' => 'Contribution',
'bao' => 'CRM_Contribute_BAO_Contribution',
'localizable' => 0,
'html' => [
'type' => 'CheckBox',
],
],
];
CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
}
......
......@@ -67,19 +67,6 @@ class CRM_Upgrade_Incremental_php_FiveTwenty extends CRM_Upgrade_Incremental_Bas
* (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', [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;
// }
......@@ -92,6 +79,8 @@ class CRM_Upgrade_Incremental_php_FiveTwenty extends CRM_Upgrade_Incremental_Bas
public function upgrade_5_20_alpha1($rev) {
$this->addTask('Add frontend title column to contribution page table', 'addColumn', 'civicrm_contribution_page',
'frontend_title', "varchar(255) DEFAULT NULL COMMENT 'Contribution Page Public title'", TRUE, '5.20.alpha1');
$this->addTask('Add is_template field to civicrm_contribution', 'addColumn', 'civicrm_contribution', 'is_template',
"tinyint(4) DEFAULT '0' COMMENT 'Shows this is a template for recurring contributions.'", FALSE, '5.20.alpha1');
$this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
}
......
......@@ -9,7 +9,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 31,
'contact_id' => 32,
'receive_date' => '20120511',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -18,7 +18,7 @@ function contribution_create_example() {
'net_amount' => '95',
'source' => 'SSF',
'contribution_status_id' => 1,
'honor_contact_id' => 32,
'honor_contact_id' => 33,
];
try{
......@@ -56,7 +56,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '31',
'contact_id' => '32',
'financial_type_id' => '1',
'contribution_page_id' => '',
'payment_instrument_id' => '4',
......@@ -85,6 +85,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => '',
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
],
],
......
......@@ -9,7 +9,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 25,
'contact_id' => 26,
'receive_date' => '2012-01-01',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -59,7 +59,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '25',
'contact_id' => '26',
'financial_type_id' => '1',
'contribution_page_id' => '',
'payment_instrument_id' => '1',
......@@ -88,6 +88,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => '',
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
],
],
......
......@@ -9,7 +9,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 27,
'contact_id' => 28,
'receive_date' => '20120511',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -20,7 +20,7 @@ function contribution_create_example() {
'contribution_status_id' => 1,
'soft_credit' => [
'1' => [
'contact_id' => 28,
'contact_id' => 29,
'amount' => 50,
'soft_credit_type_id' => 3,
],
......@@ -62,7 +62,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '27',
'contact_id' => '28',
'financial_type_id' => '1',
'contribution_page_id' => '',
'payment_instrument_id' => '4',
......@@ -91,6 +91,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => '',
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
],
],
......
......@@ -9,7 +9,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 29,
'contact_id' => 30,
'receive_date' => '20120511',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -18,7 +18,7 @@ function contribution_create_example() {
'net_amount' => '95',
'source' => 'SSF',
'contribution_status_id' => 1,
'soft_credit_to' => 30,
'soft_credit_to' => 31,
];
try{
......@@ -56,7 +56,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '29',
'contact_id' => '30',
'financial_type_id' => '1',
'contribution_page_id' => '',
'payment_instrument_id' => '4',
......@@ -85,6 +85,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => '',
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
],
],
......
......@@ -7,7 +7,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 1,
'contact_id' => 39,
'receive_date' => '20120511',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -54,7 +54,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '1',
'contact_id' => '39',
'financial_type_id' => '1',
'contribution_page_id' => '1',
'payment_instrument_id' => '4',
......@@ -83,6 +83,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => '',
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
],
],
......
......@@ -9,7 +9,7 @@
*/
function contribution_create_example() {
$params = [
'contact_id' => 12,
'contact_id' => 13,
'receive_date' => '20120511',
'total_amount' => '100',
'financial_type_id' => 1,
......@@ -73,7 +73,7 @@ function contribution_create_expectedresult() {
'values' => [
'1' => [
'id' => '1',
'contact_id' => '12',
'contact_id' => '13',
'financial_type_id' => '1',
'contribution_page_id' => '',
'payment_instrument_id' => '1',
......@@ -102,6 +102,7 @@ function contribution_create_expectedresult() {
'creditnote_id' => '',
'tax_amount' => 0,
'revenue_recognition_date' => '',
'is_template' => '',
'contribution_type_id' => '1',
'api.line_item.create' => [
'0' => [
......
......@@ -541,4 +541,16 @@
</html>
<add>4.7</add>
</field>
<field>
<name>is_template</name>
<title>Is a Template Contribution</title>
<type>boolean</type>
<default>0</default>
<import>true</import>
<comment>Shows this is a template for recurring contributions.</comment>
<html>
<type>CheckBox</type>
</html>
<add>5.20</add>
</field>
</table>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment