From 98813b901741b45657a752d51151f6eacebb1aba 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 'Financial' --- CRM/Financial/DAO/FinancialTrxn.php | 5 +++-- CRM/Financial/DAO/PaymentProcessor.php | 15 +++++++++----- CRM/Financial/DAO/PaymentProcessorType.php | 12 +++++++---- .../php/FiveFortyNine/Financial.bool.php | 20 +++++++++++++++++++ xml/schema/Financial/FinancialTrxn.xml | 1 + xml/schema/Financial/PaymentProcessor.xml | 5 +++++ xml/schema/Financial/PaymentProcessorType.xml | 6 ++++++ 7 files changed, 53 insertions(+), 11 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Financial.bool.php diff --git a/CRM/Financial/DAO/FinancialTrxn.php b/CRM/Financial/DAO/FinancialTrxn.php index ff401a529b..709ec8760e 100644 --- a/CRM/Financial/DAO/FinancialTrxn.php +++ b/CRM/Financial/DAO/FinancialTrxn.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/FinancialTrxn.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:ab70fbb4b84fe620236a196f5a80926e) + * (GenCodeChecksum:91bd49e83b574c92b7633805f6e0a903) */ /** @@ -104,7 +104,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { /** * Is this entry either a payment or a reversal of a payment? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -394,6 +394,7 @@ class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Payment?'), 'description' => ts('Is this entry either a payment or a reversal of a payment?'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_financial_trxn.is_payment', 'export' => TRUE, diff --git a/CRM/Financial/DAO/PaymentProcessor.php b/CRM/Financial/DAO/PaymentProcessor.php index 82622f2b69..7210013c8c 100644 --- a/CRM/Financial/DAO/PaymentProcessor.php +++ b/CRM/Financial/DAO/PaymentProcessor.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessor.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:7d4681a9b748c272c9da9807af6e4809) + * (GenCodeChecksum:7f1fd3e55d2b10ce458a9503349f9e61) */ /** @@ -86,7 +86,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Is this processor active? * - * @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_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Is this processor the default? * - * @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_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Is this processor for a test site? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -185,7 +185,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { /** * Can process recurring contributions * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -376,6 +376,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor is Active?'), 'description' => ts('Is this processor active?'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor.is_active', 'default' => '1', 'table_name' => 'civicrm_payment_processor', @@ -389,6 +390,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor Is Default?'), 'description' => ts('Is this processor the default?'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor.is_default', 'default' => '0', 'table_name' => 'civicrm_payment_processor', @@ -402,6 +404,7 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Test Processor?'), 'description' => ts('Is this processor for a test site?'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor.is_test', 'default' => '0', 'table_name' => 'civicrm_payment_processor', @@ -569,7 +572,9 @@ class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor Supports Recurring?'), 'description' => ts('Can process recurring contributions'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor.is_recur', + 'default' => '0', 'table_name' => 'civicrm_payment_processor', 'entity' => 'PaymentProcessor', 'bao' => 'CRM_Financial_BAO_PaymentProcessor', diff --git a/CRM/Financial/DAO/PaymentProcessorType.php b/CRM/Financial/DAO/PaymentProcessorType.php index 4088336a4a..e56feb8929 100644 --- a/CRM/Financial/DAO/PaymentProcessorType.php +++ b/CRM/Financial/DAO/PaymentProcessorType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Financial/PaymentProcessorType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:a24e95eecd01bdb6ff555cd307a62084) + * (GenCodeChecksum:5c849e6c7ad27a02c17defc1a3e23de7) */ /** @@ -70,7 +70,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Is this processor active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -79,7 +79,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Is this processor the default? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -188,7 +188,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { /** * Can process recurring contributions * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -304,6 +304,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor Type Is Active?'), 'description' => ts('Is this processor active?'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor_type.is_active', 'default' => '1', 'table_name' => 'civicrm_payment_processor_type', @@ -317,6 +318,7 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor Type is Default?'), 'description' => ts('Is this processor the default?'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor_type.is_default', 'default' => '0', 'table_name' => 'civicrm_payment_processor_type', @@ -520,7 +522,9 @@ class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Processor Type Supports Recurring?'), 'description' => ts('Can process recurring contributions'), + 'required' => TRUE, 'where' => 'civicrm_payment_processor_type.is_recur', + 'default' => '0', 'table_name' => 'civicrm_payment_processor_type', 'entity' => 'PaymentProcessorType', 'bao' => 'CRM_Financial_BAO_PaymentProcessorType', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Financial.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Financial.bool.php new file mode 100644 index 0000000000..22b8f9594c --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Financial.bool.php @@ -0,0 +1,20 @@ + [ + 'is_header_account' => "DEFAULT 0 COMMENT 'Is this a header account which does not allow transactions to be posted against it directly, but only to its sub-accounts?'", + 'is_deductible' => "DEFAULT 0 COMMENT 'Is this account tax-deductible?'", + 'is_tax' => "DEFAULT 0 COMMENT 'Is this account for taxes?'", + 'is_reserved' => "DEFAULT 0 COMMENT 'Is this a predefined system object?'", + 'is_active' => "DEFAULT 1 COMMENT 'Is this property active?'", + 'is_default' => "DEFAULT 0 COMMENT 'Is this account the default one (or default tax one) for its financial_account_type?'", + ], + 'civicrm_financial_trxn' => [ + 'is_payment' => "DEFAULT 0 COMMENT 'Is this entry either a payment or a reversal of a payment?'", + ], + 'civicrm_payment_processor' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this processor active?'", + 'is_default' => "DEFAULT 0 COMMENT 'Is this processor the default?'", + 'is_test' => "DEFAULT 0 COMMENT 'Is this processor for a test site?'", + 'is_recur' => "DEFAULT 0 COMMENT 'Can process recurring contributions'", + ], +]; diff --git a/xml/schema/Financial/FinancialTrxn.xml b/xml/schema/Financial/FinancialTrxn.xml index 515a78770e..f71027f61f 100644 --- a/xml/schema/Financial/FinancialTrxn.xml +++ b/xml/schema/Financial/FinancialTrxn.xml @@ -126,6 +126,7 @@ Is Payment? boolean 0 + true true Is this entry either a payment or a reversal of a payment? 4.7 diff --git a/xml/schema/Financial/PaymentProcessor.xml b/xml/schema/Financial/PaymentProcessor.xml index cec449f4c4..d839335490 100644 --- a/xml/schema/Financial/PaymentProcessor.xml +++ b/xml/schema/Financial/PaymentProcessor.xml @@ -106,6 +106,7 @@ Is this processor active? 1.8 1 + true is_default @@ -114,6 +115,7 @@ Is this processor the default? 1.8 0 + true is_test @@ -122,6 +124,7 @@ Is this processor for a test site? 1.8 0 + true UI_name_test_domain_id @@ -231,6 +234,8 @@ is_recur Processor Supports Recurring? boolean + 0 + true Can process recurring contributions 1.8 diff --git a/xml/schema/Financial/PaymentProcessorType.xml b/xml/schema/Financial/PaymentProcessorType.xml index d5a3728c3b..ab3e93b9ef 100644 --- a/xml/schema/Financial/PaymentProcessorType.xml +++ b/xml/schema/Financial/PaymentProcessorType.xml @@ -51,6 +51,8 @@ is_active Processor Type Is Active? boolean + 1 + true Is this processor active? 1.8 1 @@ -59,6 +61,8 @@ is_default Processor Type is Default? boolean + 0 + true Is this processor the default? 1.8 0 @@ -179,6 +183,8 @@ is_recur Processor Type Supports Recurring? boolean + 0 + true Can process recurring contributions 1.8 -- 2.25.1