From 6891aea73543a9febd3929434e6aafdbb1609da1 Mon Sep 17 00:00:00 2001 From: Monish Deb Date: Thu, 7 Apr 2022 18:12:15 -0700 Subject: [PATCH] Schema - Fix boolean fields in 'Campaign' --- CRM/Campaign/DAO/Campaign.php | 5 +++-- CRM/Campaign/DAO/Survey.php | 14 +++++++++----- .../php/FiveFortyNine/Campaign.bool.php | 12 ++++++++++++ xml/schema/Campaign/Campaign.xml | 1 + xml/schema/Campaign/Survey.xml | 4 ++++ 5 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Campaign.bool.php diff --git a/CRM/Campaign/DAO/Campaign.php b/CRM/Campaign/DAO/Campaign.php index 99b8489ede..58250dc3ca 100644 --- a/CRM/Campaign/DAO/Campaign.php +++ b/CRM/Campaign/DAO/Campaign.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/Campaign.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:dab6fdaa9d622daab580b32ae1172bc7) + * (GenCodeChecksum:ec15aa356537755e66854f7da660cee2) */ /** @@ -149,7 +149,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { /** * Is this Campaign enabled or disabled/cancelled? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -464,6 +464,7 @@ class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Campaign Active?'), 'description' => ts('Is this Campaign enabled or disabled/cancelled?'), + 'required' => TRUE, 'where' => 'civicrm_campaign.is_active', 'default' => '1', 'table_name' => 'civicrm_campaign', diff --git a/CRM/Campaign/DAO/Survey.php b/CRM/Campaign/DAO/Survey.php index 410b6ea812..370172d9d2 100644 --- a/CRM/Campaign/DAO/Survey.php +++ b/CRM/Campaign/DAO/Survey.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Campaign/Survey.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:d0bc187a5dd2297f5c81a7a84460fc17) + * (GenCodeChecksum:5a3eaa2d7c9afb84333c3a4601b63ab8) */ /** @@ -129,7 +129,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Is this survey enabled or disabled/cancelled? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -138,7 +138,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Is this default survey? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -192,7 +192,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Bypass the email verification. * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -219,7 +219,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { /** * Can people share the petition 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. */ @@ -426,6 +426,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Survey Is Active'), 'description' => ts('Is this survey enabled or disabled/cancelled?'), + 'required' => TRUE, 'where' => 'civicrm_survey.is_active', 'default' => '1', 'table_name' => 'civicrm_survey', @@ -439,6 +440,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is Default Survey'), 'description' => ts('Is this default survey?'), + 'required' => TRUE, 'where' => 'civicrm_survey.is_default', 'default' => '0', 'table_name' => 'civicrm_survey', @@ -528,6 +530,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('No Email Verification'), 'description' => ts('Bypass the email verification.'), + 'required' => TRUE, 'where' => 'civicrm_survey.bypass_confirm', 'default' => '0', 'table_name' => 'civicrm_survey', @@ -572,6 +575,7 @@ class CRM_Campaign_DAO_Survey extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Is shared through social media'), 'description' => ts('Can people share the petition through social media?'), + 'required' => TRUE, 'where' => 'civicrm_survey.is_share', 'default' => '1', 'table_name' => 'civicrm_survey', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Campaign.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Campaign.bool.php new file mode 100644 index 0000000000..11963d3c2e --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Campaign.bool.php @@ -0,0 +1,12 @@ + [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this Campaign enabled or disabled/cancelled?'", + ], + 'civicrm_survey' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this survey enabled or disabled/cancelled?'", + 'is_default' => "DEFAULT 0 COMMENT 'Is this default survey?'", + 'bypass_confirm' => "DEFAULT 0 COMMENT 'Bypass the email verification.'", + 'is_share' => "DEFAULT 1 COMMENT 'Can people share the petition through social media?'", + ], +]; diff --git a/xml/schema/Campaign/Campaign.xml b/xml/schema/Campaign/Campaign.xml index 0b6000960a..ffd14e8e13 100644 --- a/xml/schema/Campaign/Campaign.xml +++ b/xml/schema/Campaign/Campaign.xml @@ -192,6 +192,7 @@ Is Campaign Active? boolean 1 + true Is this Campaign enabled or disabled/cancelled? 3.3 diff --git a/xml/schema/Campaign/Survey.xml b/xml/schema/Campaign/Survey.xml index 0433f898b5..612af59932 100644 --- a/xml/schema/Campaign/Survey.xml +++ b/xml/schema/Campaign/Survey.xml @@ -142,6 +142,7 @@ Survey Is Active boolean 1 + true Is this survey enabled or disabled/cancelled? 3.3 @@ -151,6 +152,7 @@ Is Default Survey boolean 0 + true Is this default survey? 3.3 @@ -227,6 +229,7 @@ No Email Verification boolean 0 + true Bypass the email verification. 4.2 @@ -257,6 +260,7 @@ Is shared through social media boolean 1 + true Can people share the petition through social media? 4.4 -- 2.25.1