From 22a0d06ae12f9c690af6da0cd7c871f5f7361755 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 'Contact' --- CRM/Contact/DAO/Contact.php | 17 ++++++---- CRM/Contact/DAO/ContactType.php | 8 +++-- CRM/Contact/DAO/DashboardContact.php | 7 ++-- CRM/Contact/DAO/Group.php | 12 ++++--- CRM/Contact/DAO/Relationship.php | 5 +-- CRM/Contact/DAO/RelationshipCache.php | 5 +-- CRM/Contact/DAO/RelationshipType.php | 9 ++++-- .../php/FiveFortyNine/Contact.bool.php | 32 +++++++++++++++++++ xml/schema/Contact/Contact.xml | 6 ++++ xml/schema/Contact/ContactType.xml | 2 ++ xml/schema/Contact/DashboardContact.xml | 5 ++- xml/schema/Contact/Group.xml | 4 +++ xml/schema/Contact/Relationship.xml | 1 + xml/schema/Contact/RelationshipCache.xml | 1 + xml/schema/Contact/RelationshipType.xml | 3 ++ 15 files changed, 93 insertions(+), 24 deletions(-) create mode 100644 CRM/Upgrade/Incremental/php/FiveFortyNine/Contact.bool.php diff --git a/CRM/Contact/DAO/Contact.php b/CRM/Contact/DAO/Contact.php index 3270f8789b..4a327bb4b0 100644 --- a/CRM/Contact/DAO/Contact.php +++ b/CRM/Contact/DAO/Contact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Contact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1ed20aff22fc1effbd05ea8411e48139) + * (GenCodeChecksum:67196fefde2ec151c97d463869102e21) */ /** @@ -84,35 +84,35 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { public $contact_sub_type; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ public $do_not_email; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ public $do_not_phone; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ public $do_not_mail; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ public $do_not_sms; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -638,6 +638,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'name' => 'do_not_email', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Do Not Email'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contact.do_not_email', 'headerPattern' => '/d(o )?(not )?(email)/i', @@ -658,6 +659,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'name' => 'do_not_phone', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Do Not Phone'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contact.do_not_phone', 'headerPattern' => '/d(o )?(not )?(call|phone)/i', @@ -678,6 +680,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'name' => 'do_not_mail', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Do Not Mail'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contact.do_not_mail', 'headerPattern' => '/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i', @@ -698,6 +701,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'name' => 'do_not_sms', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Do Not Sms'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contact.do_not_sms', 'headerPattern' => '/d(o )?(not )?(sms)/i', @@ -718,6 +722,7 @@ class CRM_Contact_DAO_Contact extends CRM_Core_DAO { 'name' => 'do_not_trade', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Do Not Trade'), + 'required' => TRUE, 'import' => TRUE, 'where' => 'civicrm_contact.do_not_trade', 'headerPattern' => '/d(o )?(not )?(trade)/i', diff --git a/CRM/Contact/DAO/ContactType.php b/CRM/Contact/DAO/ContactType.php index 00043c7bd9..07b5211241 100644 --- a/CRM/Contact/DAO/ContactType.php +++ b/CRM/Contact/DAO/ContactType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/ContactType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9f3dbdc9b75770b084a6f2d6a4dfc652) + * (GenCodeChecksum:c2f6858290ecb933caba200b565c69bd) */ /** @@ -96,7 +96,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { /** * Is this entry active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -105,7 +105,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { /** * Is this contact type a predefined system type * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -274,6 +274,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Contact Type Is Active?'), 'description' => ts('Is this entry active?'), + 'required' => TRUE, 'where' => 'civicrm_contact_type.is_active', 'default' => '1', 'table_name' => 'civicrm_contact_type', @@ -287,6 +288,7 @@ class CRM_Contact_DAO_ContactType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Contact Type is Reserved?'), 'description' => ts('Is this contact type a predefined system type'), + 'required' => TRUE, 'where' => 'civicrm_contact_type.is_reserved', 'default' => '0', 'table_name' => 'civicrm_contact_type', diff --git a/CRM/Contact/DAO/DashboardContact.php b/CRM/Contact/DAO/DashboardContact.php index b8881db880..fe7aeebb20 100644 --- a/CRM/Contact/DAO/DashboardContact.php +++ b/CRM/Contact/DAO/DashboardContact.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/DashboardContact.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:fd3f7ea02b93c0dd3ecd46fb757bc2a3) + * (GenCodeChecksum:ca2325df4ca179436e4901bbed693e20) */ /** @@ -67,7 +67,7 @@ class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO { /** * Is this widget active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -195,8 +195,9 @@ class CRM_Contact_DAO_DashboardContact extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Dashlet is Active?'), 'description' => ts('Is this widget active?'), + 'required' => TRUE, 'where' => 'civicrm_dashboard_contact.is_active', - 'default' => '0', + 'default' => '1', 'table_name' => 'civicrm_dashboard_contact', 'entity' => 'DashboardContact', 'bao' => 'CRM_Contact_BAO_DashboardContact', diff --git a/CRM/Contact/DAO/Group.php b/CRM/Contact/DAO/Group.php index 3a2bf933cb..2f203b3f89 100644 --- a/CRM/Contact/DAO/Group.php +++ b/CRM/Contact/DAO/Group.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Group.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b58b83a311a0a9a7cd2350b452d2ca9a) + * (GenCodeChecksum:8b5d08ec2b844a6b9167fa80a590a58c) */ /** @@ -113,7 +113,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { /** * Is this entry active? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -203,14 +203,14 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { /** * Is this group hidden? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ public $is_hidden; /** - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -395,7 +395,9 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Group Enabled'), 'description' => ts('Is this entry active?'), + 'required' => TRUE, 'where' => 'civicrm_group.is_active', + 'default' => '1', 'table_name' => 'civicrm_group', 'entity' => 'Group', 'bao' => 'CRM_Contact_BAO_Group', @@ -544,6 +546,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Group is Hidden'), 'description' => ts('Is this group hidden?'), + 'required' => TRUE, 'where' => 'civicrm_group.is_hidden', 'default' => '0', 'table_name' => 'civicrm_group', @@ -556,6 +559,7 @@ class CRM_Contact_DAO_Group extends CRM_Core_DAO { 'name' => 'is_reserved', 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Group is Reserved'), + 'required' => TRUE, 'where' => 'civicrm_group.is_reserved', 'default' => '0', 'table_name' => 'civicrm_group', diff --git a/CRM/Contact/DAO/Relationship.php b/CRM/Contact/DAO/Relationship.php index 0ecfdcf999..ede52c66c6 100644 --- a/CRM/Contact/DAO/Relationship.php +++ b/CRM/Contact/DAO/Relationship.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/Relationship.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:9857c3a39c853ba7abfeb246af8a70ec) + * (GenCodeChecksum:138d23f70bbc1e8c3b1ad2d247e9a8df) */ /** @@ -104,7 +104,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { /** * is the relationship active ? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -321,6 +321,7 @@ class CRM_Contact_DAO_Relationship extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Relationship Is Active'), 'description' => ts('is the relationship active ?'), + 'required' => TRUE, 'where' => 'civicrm_relationship.is_active', 'default' => '1', 'table_name' => 'civicrm_relationship', diff --git a/CRM/Contact/DAO/RelationshipCache.php b/CRM/Contact/DAO/RelationshipCache.php index 41044bfeed..36fbb03172 100644 --- a/CRM/Contact/DAO/RelationshipCache.php +++ b/CRM/Contact/DAO/RelationshipCache.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/RelationshipCache.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:1bc7c47a01326782645f1cfac11c6d14) + * (GenCodeChecksum:637d262d0fe18e30673e5d1b1317e4aa) */ /** @@ -123,7 +123,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO { /** * is the relationship active ? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -358,6 +358,7 @@ class CRM_Contact_DAO_RelationshipCache extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Relationship Is Active'), 'description' => ts('is the relationship active ?'), + 'required' => TRUE, 'where' => 'civicrm_relationship_cache.is_active', 'default' => '1', 'table_name' => 'civicrm_relationship_cache', diff --git a/CRM/Contact/DAO/RelationshipType.php b/CRM/Contact/DAO/RelationshipType.php index 3bd1a0d80c..0104b22e2e 100644 --- a/CRM/Contact/DAO/RelationshipType.php +++ b/CRM/Contact/DAO/RelationshipType.php @@ -6,7 +6,7 @@ * * Generated from xml/schema/CRM/Contact/RelationshipType.xml * DO NOT EDIT. Generated by CRM_Core_CodeGen - * (GenCodeChecksum:b020221ec1e27cbaf4eba0b9457a8448) + * (GenCodeChecksum:f420b1007ffa4e74cd3e23e34133f170) */ /** @@ -123,7 +123,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { /** * Is this relationship type a predefined system type (can not be changed or de-activated)? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -132,7 +132,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { /** * Is this relationship type currently active (i.e. can be used when creating or editing relationships)? * - * @var bool|string|null + * @var bool|string * (SQL type: tinyint) * Note that values will be retrieved from the database as a string. */ @@ -357,7 +357,9 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Relationship Type is Reserved'), 'description' => ts('Is this relationship type a predefined system type (can not be changed or de-activated)?'), + 'required' => TRUE, 'where' => 'civicrm_relationship_type.is_reserved', + 'default' => '0', 'table_name' => 'civicrm_relationship_type', 'entity' => 'RelationshipType', 'bao' => 'CRM_Contact_BAO_RelationshipType', @@ -372,6 +374,7 @@ class CRM_Contact_DAO_RelationshipType extends CRM_Core_DAO { 'type' => CRM_Utils_Type::T_BOOLEAN, 'title' => ts('Relationship Type is Active'), 'description' => ts('Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'), + 'required' => TRUE, 'where' => 'civicrm_relationship_type.is_active', 'default' => '1', 'table_name' => 'civicrm_relationship_type', diff --git a/CRM/Upgrade/Incremental/php/FiveFortyNine/Contact.bool.php b/CRM/Upgrade/Incremental/php/FiveFortyNine/Contact.bool.php new file mode 100644 index 0000000000..ccb91d3dd3 --- /dev/null +++ b/CRM/Upgrade/Incremental/php/FiveFortyNine/Contact.bool.php @@ -0,0 +1,32 @@ + [ + 'do_not_email' => "DEFAULT 0", + 'do_not_phone' => "DEFAULT 0", + 'do_not_mail' => "DEFAULT 0", + 'do_not_sms' => "DEFAULT 0", + 'do_not_trade' => "DEFAULT 0", + ], + 'civicrm_contact_type' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this entry active?'", + 'is_reserved' => "DEFAULT 0 COMMENT 'Is this contact type a predefined system type'", + ], + 'civicrm_dashboard_contact' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this widget active?'", + ], + 'civicrm_group' => [ + 'is_active' => "DEFAULT 1 COMMENT 'Is this entry active?'", + 'is_hidden' => "DEFAULT 0 COMMENT 'Is this group hidden?'", + 'is_reserved' => "DEFAULT 0", + ], + 'civicrm_relationship' => [ + 'is_active' => "DEFAULT 1 COMMENT 'is the relationship active ?'", + ], + 'civicrm_relationship_cache' => [ + 'is_active' => "DEFAULT 1 COMMENT 'is the relationship active ?'", + ], + 'civicrm_relationship_type' => [ + 'is_reserved' => "DEFAULT 0 COMMENT 'Is this relationship type a predefined system type (can not be changed or de-activated)?'", + 'is_active' => "DEFAULT 1 COMMENT 'Is this relationship type currently active (i.e. can be used when creating or editing relationships)?'", + ], +]; diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index 4030373fc2..6ebb5f7df9 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -93,6 +93,7 @@ /d(o )?(not )?(email)/i /^\d{1,}$/ 0 + true CheckBox @@ -103,6 +104,7 @@ do_not_phone boolean 0 + true true /d(o )?(not )?(call|phone)/i /^\d{1,}$/ @@ -119,6 +121,7 @@ /^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i /^\d{1,}$/ 0 + true 1.1 CheckBox @@ -132,6 +135,7 @@ /d(o )?(not )?(sms)/i /^\d{1,}$/ 0 + true 3.0 CheckBox @@ -145,6 +149,7 @@ /d(o )?(not )?(trade)/i /^\d{1,}$/ 0 + true 1.1 CheckBox @@ -156,6 +161,7 @@ boolean No Bulk Emails (User Opt Out) 0 + true true true Has the contact opted out from receiving all bulk email from the organization or site domain? diff --git a/xml/schema/Contact/ContactType.xml b/xml/schema/Contact/ContactType.xml index 264da30c3d..b9fe0b75b5 100644 --- a/xml/schema/Contact/ContactType.xml +++ b/xml/schema/Contact/ContactType.xml @@ -104,6 +104,7 @@ Contact Type Is Active? boolean 1 + true Is this entry active? 3.1 @@ -112,6 +113,7 @@ Contact Type is Reserved? boolean 0 + true Is this contact type a predefined system type 3.1 diff --git a/xml/schema/Contact/DashboardContact.xml b/xml/schema/Contact/DashboardContact.xml index 9a9a128e50..eda7bb078f 100644 --- a/xml/schema/Contact/DashboardContact.xml +++ b/xml/schema/Contact/DashboardContact.xml @@ -79,6 +79,7 @@ Dashlet is Minimized? Is Minimized? 0 + true 3.1 4.7 @@ -88,6 +89,7 @@ Dashlet is FullScreen? Is Fullscreen? 1 + true 3.1 4.7 @@ -96,7 +98,8 @@ boolean Dashlet is Active? Is this widget active? - 0 + 1 + true 3.1 diff --git a/xml/schema/Contact/Group.xml b/xml/schema/Contact/Group.xml index 945c805cf2..ad0a6569f2 100644 --- a/xml/schema/Contact/Group.xml +++ b/xml/schema/Contact/Group.xml @@ -90,6 +90,8 @@ is_active boolean + 1 + true Group Enabled Is this entry active? 1.1 @@ -193,6 +195,7 @@ boolean Group is Hidden 0 + true Is this group hidden? 2.2 @@ -201,6 +204,7 @@ boolean Group is Reserved 0 + true 4.2 diff --git a/xml/schema/Contact/Relationship.xml b/xml/schema/Contact/Relationship.xml index 141ae932c6..384c455411 100644 --- a/xml/schema/Contact/Relationship.xml +++ b/xml/schema/Contact/Relationship.xml @@ -119,6 +119,7 @@ boolean Relationship Is Active 1 + true is the relationship active ? 1.1 diff --git a/xml/schema/Contact/RelationshipCache.xml b/xml/schema/Contact/RelationshipCache.xml index e53094d61a..62d9ea1d2f 100644 --- a/xml/schema/Contact/RelationshipCache.xml +++ b/xml/schema/Contact/RelationshipCache.xml @@ -194,6 +194,7 @@ boolean Relationship Is Active 1 + true is the relationship active ? 5.29 diff --git a/xml/schema/Contact/RelationshipType.xml b/xml/schema/Contact/RelationshipType.xml index c55db740c4..ba388a8368 100644 --- a/xml/schema/Contact/RelationshipType.xml +++ b/xml/schema/Contact/RelationshipType.xml @@ -151,12 +151,15 @@ CheckBox 1.1 + 0 + true is_active Relationship Type is Active boolean 1 + true Is this relationship type currently active (i.e. can be used when creating or editing relationships)? CheckBox -- 2.25.1