From e3f8f0ccd3dae882165324cdbe2bd6326e5cfbe1 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Thu, 7 Apr 2022 18:12:16 -0700 Subject: [PATCH] Schema - Fix boolean fields in 'Contribute' --- CRM/Contribute/DAO/ContributionPage.php | 45 ++++++++++++------- CRM/Contribute/DAO/ContributionRecur.php | 8 ++-- CRM/Contribute/DAO/ContributionSoft.php | 5 ++- CRM/Contribute/DAO/Premium.php | 3 +- CRM/Contribute/DAO/Widget.php | 6 ++- .../php/FiveFortyNine/Contribute.bool.php | 38 ++++++++++++++++ xml/schema/Contribute/ContributionPage.xml | 15 +++++++ xml/schema/Contribute/ContributionRecur.xml | 2 + xml/schema/Contribute/ContributionSoft.xml | 1 + xml/schema/Contribute/Premium.xml | 1 + xml/schema/Contribute/Widget.xml | 2 + 11 files changed, 103 insertions(+), 23 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Contribute.bool.php diff --git a/CRM/Contribute/DAO/ContributionPage.php b/CRM/Contribute/DAO/ContributionPage.php index 1efbad0a12..803443f783 100644 --- a/CRM/Contribute/DAO/ContributionPage.php +++ b/CRM/Contribute/DAO/ContributionPage.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionPage.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:e33f9a31d9be56f20e20c753313478d1) + * (GenCodeChecksum:7419936ebe47d1c999473be6571682e7) */ /** @@ -86,7 +86,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - processing logic must reject transaction at confirmation stage if pay method != credit card * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -95,7 +95,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - allows real-time monetary transactions otherwise non-monetary transactions * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -104,7 +104,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - allows recurring contributions, valid only for PayPal_Standard * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -113,7 +113,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if false, the confirm page in contribution pages gets skipped * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -131,7 +131,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - supports recurring intervals * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -140,7 +140,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - asks user for recurring installments * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -149,7 +149,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - user is able to adjust payment start date * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -158,7 +158,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - allows the user to send payment directly to the org later * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -221,7 +221,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true, page will include an input text field where user can enter their own amount * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -293,7 +293,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true, receipt is automatically emailed to contact on success * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -347,7 +347,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Is this property active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -365,7 +365,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Is this property active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -428,7 +428,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * Can people share the contribution page through social media? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -437,7 +437,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { /** * if true - billing block is required for online contribution page * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -594,6 +594,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Credit Card Only?'), 'description' => ts('if true - processing logic must reject transaction at confirmation stage if pay method != credit card'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_credit_card_only', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -607,6 +608,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Monetary'), 'description' => ts('if true - allows real-time monetary transactions otherwise non-monetary transactions'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_monetary', 'default' => '1', 'table_name' => 'civicrm_contribution_page', @@ -620,6 +622,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Recurring'), 'description' => ts('if true - allows recurring contributions, valid only for PayPal_Standard'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_recur', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -633,6 +636,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Confirmation Page?'), 'description' => ts('if false, the confirm page in contribution pages gets skipped'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_confirm_enabled', 'default' => '1', 'table_name' => 'civicrm_contribution_page', @@ -669,6 +673,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Support Recurring Intervals'), 'description' => ts('if true - supports recurring intervals'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_recur_interval', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -682,6 +687,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Recurring Installments?'), 'description' => ts('if true - asks user for recurring installments'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_recur_installments', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -695,6 +701,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Adjust Recurring Start Date'), 'description' => ts('if true - user is able to adjust payment start date'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.adjust_recur_start_date', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -708,6 +715,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Pay Later'), 'description' => ts('if true - allows the user to send payment directly to the org later'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_pay_later', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -809,6 +817,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Allow Other Amounts'), 'description' => ts('if true, page will include an input text field where user can enter their own amount'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_allow_other_amount', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -933,6 +942,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Send email Receipt'), 'description' => ts('if true, receipt is automatically emailed to contact on success'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_email_receipt', 'default' => '0', 'table_name' => 'civicrm_contribution_page', @@ -1019,7 +1029,9 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Page Active?'), 'description' => ts('Is this property active?'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_active', + 'default' => '1', 'table_name' => 'civicrm_contribution_page', 'entity' => 'ContributionPage', 'bao' => 'CRM_Contribute_BAO_ContributionPage', @@ -1048,6 +1060,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Amount Block Active?'), 'description' => ts('Is this property active?'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.amount_block_is_active', 'default' => '1', 'table_name' => 'civicrm_contribution_page', @@ -1164,6 +1177,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Contribution Page Shared?'), 'description' => ts('Can people share the contribution page through social media?'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_share', 'default' => '1', 'table_name' => 'civicrm_contribution_page', @@ -1177,6 +1191,7 @@ class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is billing block required'), 'description' => ts('if true - billing block is required for online contribution page'), + 'required' => TRUE, 'where' => 'civicrm_contribution_page.is_billing_required', 'default' => '0', 'table_name' => 'civicrm_contribution_page', diff --git a/CRM/Contribute/DAO/ContributionRecur.php b/CRM/Contribute/DAO/ContributionRecur.php index 2806acb2d8..7ac2191332 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:6dcf9956d80db83ef6e3d871c1b973d0) + * (GenCodeChecksum:caadace3dd39c9bcc5f340bd9ff4da95) */ /** @@ -192,7 +192,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { public $contribution_status_id; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -282,7 +282,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { /** * if true, receipt is automatically emailed to contact on each successful payment * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -667,6 +667,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'name' => 'is_test', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Test'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contribution_recur.is_test', 'export' => TRUE, @@ -859,6 +860,7 @@ class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Send email Receipt?'), 'description' => ts('if true, receipt is automatically emailed to contact on each successful payment'), + 'required' => TRUE, 'where' => 'civicrm_contribution_recur.is_email_receipt', 'default' => '1', 'table_name' => 'civicrm_contribution_recur', diff --git a/CRM/Contribute/DAO/ContributionSoft.php b/CRM/Contribute/DAO/ContributionSoft.php index 5db113938a..98294b9d6c 100644 --- a/CRM/Contribute/DAO/ContributionSoft.php +++ b/CRM/Contribute/DAO/ContributionSoft.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/ContributionSoft.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:78899ec4310e1facc05fdb11cfac1432) + * (GenCodeChecksum:9d890f5a0f0efc24ce1adaf5c84ac54e) */ /** @@ -86,7 +86,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { public $pcp_id; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -287,6 +287,7 @@ class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO { 'name' => 'pcp_display_in_roll', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Soft Contribution Display on PCP'), + 'required' => TRUE, 'where' => 'civicrm_contribution_soft.pcp_display_in_roll', 'default' => '0', 'table_name' => 'civicrm_contribution_soft', diff --git a/CRM/Contribute/DAO/Premium.php b/CRM/Contribute/DAO/Premium.php index 803ac3598f..437a2e22b7 100644 --- a/CRM/Contribute/DAO/Premium.php +++ b/CRM/Contribute/DAO/Premium.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Premium.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a458d7c03a26386d799d9d69db691051) + * (GenCodeChecksum:4fc24f46e0da197aafb4399dd0965aa4) */ /** @@ -283,6 +283,7 @@ class CRM_Contribute_DAO_Premium extends CRM_Core_DAO { 'description' => ts('Boolean. Should we automatically display minimum contribution amount text after the premium descriptions.'), 'required' => TRUE, 'where' => 'civicrm_premiums.premiums_display_min_contribution', + 'default' => '0', 'table_name' => 'civicrm_premiums', 'entity' => 'Premium', 'bao' => 'CRM_Contribute_BAO_Premium', diff --git a/CRM/Contribute/DAO/Widget.php b/CRM/Contribute/DAO/Widget.php index c2d381e35c..3881be8636 100644 --- a/CRM/Contribute/DAO/Widget.php +++ b/CRM/Contribute/DAO/Widget.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contribute/Widget.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:4148353263bb1ae6e21aff61b94cc701) + * (GenCodeChecksum:8327209557468328fd4ec358866fdab0) */ /** @@ -52,7 +52,7 @@ class CRM_Contribute_DAO_Widget extends CRM_Core_DAO { /** * Is this property active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -245,7 +245,9 @@ class CRM_Contribute_DAO_Widget extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Enabled?'), 'description' => ts('Is this property active?'), + 'required' => TRUE, 'where' => 'civicrm_contribution_widget.is_active', + 'default' => '1', 'table_name' => 'civicrm_contribution_widget', 'entity' => 'Widget', 'bao' => 'CRM_Contribute_BAO_Widget', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Contribute.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Contribute.bool.php new file mode 100644 index 0000000000..55453f05a5 --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Contribute.bool.php @@ -0,0 +1,38 @@ + [ + 'is_test' => "DEFAULT 0", + 'is_pay_later' => "DEFAULT 0", + 'is_template' => "DEFAULT 0 COMMENT 'Shows this is a template for recurring contributions.'", + ], + 'civicrm_contribution_page' => [ + 'is_credit_card_only' => "DEFAULT 0 COMMENT 'if true - processing logic must reject transaction at confirmation stage if pay method != credit card'", + 'is_monetary' => "DEFAULT 1 COMMENT 'if true - allows real-time monetary transactions otherwise non-monetary transactions'", + 'is_recur' => "DEFAULT 0 COMMENT 'if true - allows recurring contributions, valid only for PayPal_Standard'", + 'is_confirm_enabled' => "DEFAULT 1 COMMENT 'if false, the confirm page in contribution pages gets skipped'", + 'is_recur_interval' => "DEFAULT 0 COMMENT 'if true - supports recurring intervals'", + 'is_recur_installments' => "DEFAULT 0 COMMENT 'if true - asks user for recurring installments'", + 'adjust_recur_start_date' => "DEFAULT 0 COMMENT 'if true - user is able to adjust payment start date'", + 'is_pay_later' => "DEFAULT 0 COMMENT 'if true - allows the user to send payment directly to the org later'", + 'is_allow_other_amount' => "DEFAULT 0 COMMENT 'if true, page will include an input text field where user can enter their own amount'", + 'is_email_receipt' => "DEFAULT 0 COMMENT 'if true, receipt is automatically emailed to contact on success'", + 'is_active' => "DEFAULT 1 COMMENT 'Is this property active?'", + 'amount_block_is_active' => "DEFAULT 1 COMMENT 'Is this property active?'", + 'is_share' => "DEFAULT 1 COMMENT 'Can people share the contribution page through social media?'", + 'is_billing_required' => "DEFAULT 0 COMMENT 'if true - billing block is required for online contribution page'", + ], + 'civicrm_contribution_widget' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this property active?'", + ], + 'civicrm_contribution_recur' => [ + 'is_test' => "DEFAULT 0", + 'is_email_receipt' => "DEFAULT 1 COMMENT 'if true, receipt is automatically emailed to contact on each successful payment'", + ], + 'civicrm_contribution_soft' => [ + 'pcp_display_in_roll' => "DEFAULT 0", + ], + 'civicrm_premiums' => [ + 'premiums_display_min_contribution' => 'DEFAULT 0', + ], +]; diff --git a/xml/schema/Contribute/ContributionPage.xml b/xml/schema/Contribute/ContributionPage.xml index 3402bb63fb..25d267f559 100644 --- a/xml/schema/Contribute/ContributionPage.xml +++ b/xml/schema/Contribute/ContributionPage.xml @@ -91,6 +91,7 @@ boolean if true - processing logic must reject transaction at confirmation stage if pay method != credit card 0 + true 1.3 @@ -98,6 +99,7 @@ Is Monetary boolean 1 + true if true - allows real-time monetary transactions otherwise non-monetary transactions 1.6 @@ -106,6 +108,7 @@ Is Recurring boolean 0 + true if true - allows recurring contributions, valid only for PayPal_Standard 1.6 @@ -114,6 +117,7 @@ Confirmation Page? boolean 1 + true if false, the confirm page in contribution pages gets skipped 4.2 @@ -139,6 +143,7 @@ Support Recurring Intervals boolean 0 + true if true - supports recurring intervals 2.1 @@ -147,6 +152,7 @@ Recurring Installments? boolean 0 + true if true - asks user for recurring installments 4.3 @@ -155,6 +161,7 @@ Adjust Recurring Start Date boolean 0 + true if true - user is able to adjust payment start date 4.7 @@ -163,6 +170,7 @@ Pay Later boolean 0 + true if true - allows the user to send payment directly to the org later 2.0 @@ -226,6 +234,7 @@ boolean if true, page will include an input text field where user can enter their own amount 0 + true 1.3 @@ -299,6 +308,7 @@ boolean if true, receipt is automatically emailed to contact on success 0 + true 1.3 @@ -351,6 +361,8 @@ is_active Is Page Active? boolean + 1 + true Is this property active? 1.3 @@ -373,6 +385,7 @@ boolean Is this property active? 1 + true 1.5 @@ -463,6 +476,7 @@ Is Contribution Page Shared? boolean 1 + true Can people share the contribution page through social media? 4.1 @@ -471,6 +485,7 @@ Is billing block required boolean 0 + true if true - billing block is required for online contribution page 4.6 diff --git a/xml/schema/Contribute/ContributionRecur.xml b/xml/schema/Contribute/ContributionRecur.xml index db0e56832b..d15272ffbf 100644 --- a/xml/schema/Contribute/ContributionRecur.xml +++ b/xml/schema/Contribute/ContributionRecur.xml @@ -283,6 +283,7 @@ Test boolean 0 + true true CheckBox @@ -447,6 +448,7 @@ boolean if true, receipt is automatically emailed to contact on each successful payment 1 + true 4.1 CheckBox diff --git a/xml/schema/Contribute/ContributionSoft.xml b/xml/schema/Contribute/ContributionSoft.xml index 8e251ff206..6d081ca1eb 100644 --- a/xml/schema/Contribute/ContributionSoft.xml +++ b/xml/schema/Contribute/ContributionSoft.xml @@ -131,6 +131,7 @@ boolean Soft Contribution Display on PCP 0 + true 2.2 diff --git a/xml/schema/Contribute/Premium.xml b/xml/schema/Contribute/Premium.xml index 469b62450f..9a783c324e 100644 --- a/xml/schema/Contribute/Premium.xml +++ b/xml/schema/Contribute/Premium.xml @@ -89,6 +89,7 @@ premiums_display_min_contribution Display Minimum Contribution? boolean + 0 true Boolean. Should we automatically display minimum contribution amount text after the premium descriptions. 1.4 diff --git a/xml/schema/Contribute/Widget.xml b/xml/schema/Contribute/Widget.xml index 8ced050633..1dd2183293 100644 --- a/xml/schema/Contribute/Widget.xml +++ b/xml/schema/Contribute/Widget.xml @@ -43,6 +43,8 @@ is_active Enabled? boolean + 1 + true Is this property active? 2.0 -- 2.25.1