Add is_active field to Country/StateProvince/County
authorMatthew Wire <mjw@mjwconsult.co.uk>
Tue, 26 Jan 2021 10:54:41 +0000 (10:54 +0000)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 29 Jan 2021 09:40:07 +0000 (09:40 +0000)
CRM/Core/DAO/Country.php
CRM/Core/DAO/County.php
CRM/Core/DAO/StateProvince.php
CRM/Upgrade/Incremental/php/FiveThirtyFive.php
xml/schema/Core/Country.xml
xml/schema/Core/County.xml
xml/schema/Core/StateProvince.xml

index 2ac1296eb886310d63c516eb0b52f4677bdccf30..f382ac3ea1050701d994d07b22d8b0e3be4970ce 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/Country.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:baa7ed7cb183bc7f1ee86a41a001e580)
+ * (GenCodeChecksum:a2520444699acbd151d715ccadc6e2b7)
  */
 
 /**
@@ -93,6 +93,13 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
    */
   public $is_province_abbreviated;
 
+  /**
+   * Is this Country active?
+   *
+   * @var bool
+   */
+  public $is_active;
+
   /**
    * Class constructor.
    */
@@ -268,6 +275,19 @@ class CRM_Core_DAO_Country extends CRM_Core_DAO {
           'localizable' => 0,
           'add' => '3.1',
         ],
+        'is_active' => [
+          'name' => 'is_active',
+          'type' => CRM_Utils_Type::T_BOOLEAN,
+          'title' => ts('Country Is Active'),
+          'description' => ts('Is this Country active?'),
+          'where' => 'civicrm_country.is_active',
+          'default' => '1',
+          'table_name' => 'civicrm_country',
+          'entity' => 'Country',
+          'bao' => 'CRM_Core_BAO_Country',
+          'localizable' => 0,
+          'add' => '5.35',
+        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
index 6ec5bf444f745348a72817ec2530425c4f268e64..3bfb53cd73eec6995949ab66d4e88f33c5ad547b 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/County.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9e49f92ab040fc02002d5ec5507cf49a)
+ * (GenCodeChecksum:5626c0a01aa4e5da8dedc064ce3a9dff)
  */
 
 /**
@@ -58,6 +58,13 @@ class CRM_Core_DAO_County extends CRM_Core_DAO {
    */
   public $state_province_id;
 
+  /**
+   * Is this County active?
+   *
+   * @var bool
+   */
+  public $is_active;
+
   /**
    * Class constructor.
    */
@@ -163,6 +170,19 @@ class CRM_Core_DAO_County extends CRM_Core_DAO {
           ],
           'add' => '1.1',
         ],
+        'is_active' => [
+          'name' => 'is_active',
+          'type' => CRM_Utils_Type::T_BOOLEAN,
+          'title' => ts('County Is Active'),
+          'description' => ts('Is this County active?'),
+          'where' => 'civicrm_county.is_active',
+          'default' => '1',
+          'table_name' => 'civicrm_county',
+          'entity' => 'County',
+          'bao' => 'CRM_Core_DAO_County',
+          'localizable' => 0,
+          'add' => '5.35',
+        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
index c39952b65210d742a4349191aea06d66a3c2b068..777af4481b07d5e663cd6ea5640fa9c048144aa9 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Core/StateProvince.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:abd329da6e7801c901c3c97c1b09ef59)
+ * (GenCodeChecksum:92fa37e3fe2a55ec5b0efc3fc220ac4f)
  */
 
 /**
@@ -58,6 +58,13 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO {
    */
   public $country_id;
 
+  /**
+   * Is this StateProvince active?
+   *
+   * @var bool
+   */
+  public $is_active;
+
   /**
    * Class constructor.
    */
@@ -158,6 +165,19 @@ class CRM_Core_DAO_StateProvince extends CRM_Core_DAO {
           'FKClassName' => 'CRM_Core_DAO_Country',
           'add' => '1.1',
         ],
+        'is_active' => [
+          'name' => 'is_active',
+          'type' => CRM_Utils_Type::T_BOOLEAN,
+          'title' => ts('StateProvince Is Active'),
+          'description' => ts('Is this StateProvince active?'),
+          'where' => 'civicrm_state_province.is_active',
+          'default' => '1',
+          'table_name' => 'civicrm_state_province',
+          'entity' => 'StateProvince',
+          'bao' => 'CRM_Core_DAO_StateProvince',
+          'localizable' => 0,
+          'add' => '5.35',
+        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
index 05f2a69c13932bbe0826c68c340359531c1c7ed4..5d3ac9b3d83793ada1c377d96d4424b1d825f564 100644 (file)
@@ -52,21 +52,20 @@ class CRM_Upgrade_Incremental_php_FiveThirtyFive extends CRM_Upgrade_Incremental
    * (change the x in the function name):
    */
 
-  //  /**
-  //   * Upgrade function.
-  //   *
-  //   * @param string $rev
-  //   */
-  //  public function upgrade_5_0_x($rev) {
-  //    $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
-  //    $this->addTask('Do the foo change', 'taskFoo', ...);
-  //    // Additional tasks here...
-  //    // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
-  //    // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
-  //  }
+  /**
+   * Upgrade function.
+   *
+   * @param string $rev
+   */
+  public function upgrade_5_35_alpha1(string $rev): void {
+    $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
 
-  // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
-  //   return TRUE;
-  // }
+    $this->addTask('dev/core/#2329 - Add is_active to Country', 'addColumn',
+      'civicrm_country', 'is_active', "tinyint DEFAULT 1 COMMENT 'Is this Country active?'");
+    $this->addTask('dev/core/#2329 - Add is_active to StateProvince', 'addColumn',
+      'civicrm_state_province', 'is_active', "tinyint DEFAULT 1 COMMENT 'Is this StateProvince active?'");
+    $this->addTask('dev/core/#2329 - Add is_active to County', 'addColumn',
+      'civicrm_county', 'is_active', "tinyint DEFAULT 1 COMMENT 'Is this County active?'");
+  }
 
 }
index cae125581277ddf607060cf276f6b655e2ff2a63..fdf117316532abb1d2ace5de0e1fa0ba30df9845 100644 (file)
     <comment>Should state/province be displayed as abbreviation for contacts from this country?</comment>
     <add>3.1</add>
   </field>
+  <field>
+    <name>is_active</name>
+    <title>Country Is Active</title>
+    <type>boolean</type>
+    <default>1</default>
+    <comment>Is this Country active?</comment>
+    <add>5.35</add>
+  </field>
   <index>
     <name>UI_name_iso_code</name>
     <fieldName>name</fieldName>
index 0d25df45110c69d8af09ce9ec4eec2b1bb59f5a7..936064e9eb859c373bc85de2e1269d6ca23cd5c8 100644 (file)
     <key>id</key>
     <add>1.1</add>
   </foreignKey>
+  <field>
+    <name>is_active</name>
+    <title>County Is Active</title>
+    <type>boolean</type>
+    <default>1</default>
+    <comment>Is this County active?</comment>
+    <add>5.35</add>
+  </field>
   <index>
     <name>UI_name_state_id</name>
     <fieldName>name</fieldName>
index 9d7d94e8864bde4783a0707611f79470e893e421..3963138abb3eceda0b39be862ff4a7cbda3a94c7 100644 (file)
     <key>id</key>
     <add>1.1</add>
   </foreignKey>
+  <field>
+    <name>is_active</name>
+    <title>StateProvince Is Active</title>
+    <type>boolean</type>
+    <default>1</default>
+    <comment>Is this StateProvince active?</comment>
+    <add>5.35</add>
+  </field>
   <index>
     <name>UI_name_country_id</name>
     <fieldName>name</fieldName>