From bc5ae8f69d9dcb996eacc62fee944637aa31b770 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Thu, 7 Apr 2022 18:12:17 -0700 Subject: [PATCH] Schema - Fix boolean fields in 'PCP' --- CRM/PCP/DAO/PCP.php | 10 ++++++---- CRM/PCP/DAO/PCPBlock.php | 15 +++++++++------ .../Incremental/php/FiveFortyNine/PCP.bool.php | 13 +++++++++++++ xml/schema/PCP/PCP.xml | 4 +++- xml/schema/PCP/PCPBlock.xml | 7 +++++-- 5 files changed, 36 insertions(+), 13 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/PCP.bool.php diff --git a/CRM/PCP/DAO/PCP.php b/CRM/PCP/DAO/PCP.php index f0996d982c..96572086a6 100644 --- a/CRM/PCP/DAO/PCP.php +++ b/CRM/PCP/DAO/PCP.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/PCP/PCP.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9f11f3e21038c8027ad0e97497ccc356) + * (GenCodeChecksum:580fcea1bad18a3de9e966545756fbe7) */ /** @@ -146,7 +146,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * Is Personal Campaign Page enabled/active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -155,7 +155,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { /** * Notify owner via email when someone donates to page? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -445,8 +445,9 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Enabled?'), 'description' => ts('Is Personal Campaign Page enabled/active?'), + 'required' => TRUE, 'where' => 'civicrm_pcp.is_active', - 'default' => '0', + 'default' => '1', 'table_name' => 'civicrm_pcp', 'entity' => 'PCP', 'bao' => 'CRM_PCP_BAO_PCP', @@ -461,6 +462,7 @@ class CRM_PCP_DAO_PCP extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Notify Owner?'), 'description' => ts('Notify owner via email when someone donates to page?'), + 'required' => TRUE, 'where' => 'civicrm_pcp.is_notify', 'default' => '0', 'table_name' => 'civicrm_pcp', diff --git a/CRM/PCP/DAO/PCPBlock.php b/CRM/PCP/DAO/PCPBlock.php index 351bb1b483..c610d7b844 100644 --- a/CRM/PCP/DAO/PCPBlock.php +++ b/CRM/PCP/DAO/PCPBlock.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/PCP/PCPBlock.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:5528529230e5f5dbcfa0466ada0514d1) + * (GenCodeChecksum:4b4cbd3c471584e645cd442b994b73bb) */ /** @@ -95,7 +95,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? * - * @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_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * Does Personal Campaign Page allow using tell a friend? * - * @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_PCP_DAO_PCPBlock extends CRM_Core_DAO { /** * Is Personal Campaign Page Block enabled/active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -303,8 +303,9 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Approval Required?'), 'description' => ts('Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'), + 'required' => TRUE, 'where' => 'civicrm_pcp_block.is_approval_needed', - 'default' => NULL, + 'default' => '0', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', @@ -316,8 +317,9 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Tell a Friend Enabled?'), 'description' => ts('Does Personal Campaign Page allow using tell a friend?'), + 'required' => TRUE, 'where' => 'civicrm_pcp_block.is_tellfriend_enabled', - 'default' => NULL, + 'default' => '0', 'table_name' => 'civicrm_pcp_block', 'entity' => 'PCPBlock', 'bao' => 'CRM_PCP_BAO_PCPBlock', @@ -357,6 +359,7 @@ class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Enabled?'), 'description' => ts('Is Personal Campaign Page Block enabled/active?'), + 'required' => TRUE, 'where' => 'civicrm_pcp_block.is_active', 'default' => '1', 'table_name' => 'civicrm_pcp_block', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/PCP.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/PCP.bool.php new file mode 100644 index 0000000000..30c947bfef --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/PCP.bool.php @@ -0,0 +1,13 @@ + [ + 'is_active' => "DEFAULT 1 COMMENT 'Is Personal Campaign Page enabled/active?'", + 'is_notify' => "DEFAULT 0 COMMENT 'Notify owner via email when someone donates to page?'", + ], + 'civicrm_pcp_block' => [ + 'is_approval_needed' => "DEFAULT 0 COMMENT 'Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)?'", + 'is_tellfriend_enabled' => "DEFAULT 0 COMMENT 'Does Personal Campaign Page allow using tell a friend?'", + 'is_active' => "DEFAULT 1 COMMENT 'Is Personal Campaign Page Block enabled/active?'", + ], + +]; diff --git a/xml/schema/PCP/PCP.xml b/xml/schema/PCP/PCP.xml index 5195a51e7c..af8857717a 100644 --- a/xml/schema/PCP/PCP.xml +++ b/xml/schema/PCP/PCP.xml @@ -180,7 +180,8 @@ Enabled? boolean Is Personal Campaign Page enabled/active? - 0 + 1 + true 2.2 CheckBox @@ -192,6 +193,7 @@ boolean Notify owner via email when someone donates to page? 0 + true 4.6 CheckBox diff --git a/xml/schema/PCP/PCPBlock.xml b/xml/schema/PCP/PCPBlock.xml index d067ec4b31..847145c00d 100644 --- a/xml/schema/PCP/PCPBlock.xml +++ b/xml/schema/PCP/PCPBlock.xml @@ -104,7 +104,8 @@ Approval Required? boolean Does Personal Campaign Page require manual activation by administrator? (is inactive by default after setup)? - NULL + 0 + true 2.2 @@ -112,7 +113,8 @@ Tell a Friend Enabled? boolean Does Personal Campaign Page allow using tell a friend? - NULL + 0 + true 2.2 @@ -139,6 +141,7 @@ boolean Is Personal Campaign Page Block enabled/active? 1 + true 2.2 -- 2.25.1