Schema - Fix boolean fields in 'Contact'
authorMonish Deb <monish.deb@jmaconsulting.biz>
Fri, 8 Apr 2022 01:12:16 +0000 (18:12 -0700)
committerTim Otten <totten@civicrm.org>
Fri, 8 Apr 2022 01:12:16 +0000 (18:12 -0700)
15 files changed:
CRM/Contact/DAO/Contact.php
CRM/Contact/DAO/ContactType.php
CRM/Contact/DAO/DashboardContact.php
CRM/Contact/DAO/Group.php
CRM/Contact/DAO/Relationship.php
CRM/Contact/DAO/RelationshipCache.php
CRM/Contact/DAO/RelationshipType.php
CRM/Upgrade/Incremental/php/FiveFortyNine/Contact.bool.php [new file with mode: 0644]
xml/schema/Contact/Contact.xml
xml/schema/Contact/ContactType.xml
xml/schema/Contact/DashboardContact.xml
xml/schema/Contact/Group.xml
xml/schema/Contact/Relationship.xml
xml/schema/Contact/RelationshipCache.xml
xml/schema/Contact/RelationshipType.xml

index 3270f8789b17913f231a7a0d19621ea56d8ec32f..4a327bb4b0f51a2428a2db475ce3ac8b12d930f6 100644 (file)
@@ -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',
index 00043c7bd969275e1c25baf602a444dffcd18a8a..07b52112416df37fa18cda2845d83e4e93be08cb 100644 (file)
@@ -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',
index b8881db880a7c021f2acafe1025cf6b7b0792016..fe7aeebb200bf4bad3f5534cf612033f78988f95 100644 (file)
@@ -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',
index 3a2bf933cbff5a1f74a904fc1f87ca716ff8410e..2f203b3f8984052a4d5aba54677f788e7ee334cc 100644 (file)
@@ -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',
index 0ecfdcf99915ea8e6cd4b77eddd4289956c2214e..ede52c66c60f66d85cf0d7a57e3c4d962f8ff24a 100644 (file)
@@ -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',
index 41044bfeed3b6fda9827e81c69e2aef72204fe47..36fbb031720d8e0101987fd32c9b64f1a5660a3d 100644 (file)
@@ -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',
index 3bd1a0d80cdac4f68f9f850e446050ad3f9ce421..0104b22e2ecc13754ddfc31be715762e3bf2e3d8 100644 (file)
@@ -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 (file)
index 0000000..ccb91d3
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+return [
+  'civicrm_contact' => [
+    '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)?'",
+  ],
+];
index 4030373fc27fdd767f921e1b2243658918b44497..6ebb5f7df9adb0c112032679bd594cd98f1e98b5 100644 (file)
@@ -93,6 +93,7 @@
     <headerPattern>/d(o )?(not )?(email)/i</headerPattern>
     <dataPattern>/^\d{1,}$/</dataPattern>
     <default>0</default>
+    <required>true</required>
     <html>
       <type>CheckBox</type>
       <label>Do Not Email</label>
     <name>do_not_phone</name>
     <type>boolean</type>
     <default>0</default>
+    <required>true</required>
     <import>true</import>
     <headerPattern>/d(o )?(not )?(call|phone)/i</headerPattern>
     <dataPattern>/^\d{1,}$/</dataPattern>
     <headerPattern>/^(d(o\s)?n(ot\s)?mail)|(\w*)?bulk\s?(\w*)$/i</headerPattern>
     <dataPattern>/^\d{1,}$/</dataPattern>
     <default>0</default>
+    <required>true</required>
     <add>1.1</add>
     <html>
       <type>CheckBox</type>
     <headerPattern>/d(o )?(not )?(sms)/i</headerPattern>
     <dataPattern>/^\d{1,}$/</dataPattern>
     <default>0</default>
+    <required>true</required>
     <add>3.0</add>
     <html>
       <type>CheckBox</type>
     <headerPattern>/d(o )?(not )?(trade)/i</headerPattern>
     <dataPattern>/^\d{1,}$/</dataPattern>
     <default>0</default>
+    <required>true</required>
     <add>1.1</add>
     <html>
       <type>CheckBox</type>
     <type>boolean</type>
     <title>No Bulk Emails (User Opt Out)</title>
     <default>0</default>
+    <required>true</required>
     <import>true</import>
     <required>true</required>
     <comment>Has the contact opted out from receiving all bulk email from the organization or site domain?</comment>
index 264da30c3dc1e7735c2e287e71283bbb6ef4dda6..b9fe0b75b5720c0cb257a4eceb584ae59d69051b 100644 (file)
     <title>Contact Type Is Active?</title>
     <type>boolean</type>
     <default>1</default>
+    <required>true</required>
     <comment>Is this entry active?</comment>
     <add>3.1</add>
   </field>
     <title>Contact Type is Reserved?</title>
     <type>boolean</type>
     <default>0</default>
+    <required>true</required>
     <comment>Is this contact type a predefined system type</comment>
     <add>3.1</add>
   </field>
index 9a9a128e50e25ae131ba2bf4a11bf73c2ed9b3ec..eda7bb078fee5df353315a5bc0248a0f831faad8 100644 (file)
@@ -79,6 +79,7 @@
     <title>Dashlet is Minimized?</title>
     <comment>Is Minimized?</comment>
     <default>0</default>
+    <required>true</required>
     <add>3.1</add>
     <drop>4.7</drop>
   </field>
@@ -88,6 +89,7 @@
     <title>Dashlet is FullScreen?</title>
     <comment>Is Fullscreen?</comment>
     <default>1</default>
+    <required>true</required>
     <add>3.1</add>
     <drop>4.7</drop>
   </field>
@@ -96,7 +98,8 @@
     <type>boolean</type>
     <title>Dashlet is Active?</title>
     <comment>Is this widget active?</comment>
-    <default>0</default>
+    <default>1</default>
+    <required>true</required>
     <add>3.1</add>
   </field>
   <field>
index 945c805cf2de3a0774ead8f5953bfd16bce0444c..ad0a6569f2702f5f2234fd8a62db785a05b82c30 100644 (file)
@@ -90,6 +90,8 @@
   <field>
     <name>is_active</name>
     <type>boolean</type>
+    <default>1</default>
+    <required>true</required>
     <title>Group Enabled</title>
     <comment>Is this entry active?</comment>
     <add>1.1</add>
     <type>boolean</type>
     <title>Group is Hidden</title>
     <default>0</default>
+    <required>true</required>
     <comment>Is this group hidden?</comment>
     <add>2.2</add>
   </field>
     <type>boolean</type>
     <title>Group is Reserved</title>
     <default>0</default>
+    <required>true</required>
     <add>4.2</add>
   </field>
   <index>
index 141ae932c639a1f087e5a5e8a24d2e713bc57c92..384c45541102d0dea3cc63a946fb17ece8134da4 100644 (file)
     <type>boolean</type>
     <title>Relationship Is Active</title>
     <default>1</default>
+    <required>true</required>
     <comment>is the relationship active ?</comment>
     <add>1.1</add>
     <html>
index e53094d61a35ce888c4534bc9a8f04797fed5e3c..62d9ea1d2fbb1ca3b02dab2c924a70256a4a539e 100644 (file)
     <type>boolean</type>
     <title>Relationship Is Active</title>
     <default>1</default>
+    <required>true</required>
     <comment>is the relationship active ?</comment>
     <add>5.29</add>
     <html>
index c55db740c48b8fc7f3c6985657c34b2a90ba69b8..ba388a83689dbde6366cec21e796a4bdae9adcdf 100644 (file)
       <type>CheckBox</type>
     </html>
     <add>1.1</add>
+    <default>0</default>
+    <required>true</required>
   </field>
   <field>
     <name>is_active</name>
     <title>Relationship Type is Active</title>
     <type>boolean</type>
     <default>1</default>
+    <required>true</required>
     <comment>Is this relationship type currently active (i.e. can be used when creating or editing relationships)?</comment>
     <html>
       <type>CheckBox</type>