Add columns for api_entity & api_params to civicrm_saved_search
authorColeman Watts <coleman@civicrm.org>
Tue, 11 Feb 2020 22:22:42 +0000 (17:22 -0500)
committereileen <emcnaughton@wikimedia.org>
Wed, 4 Mar 2020 23:57:16 +0000 (12:57 +1300)
CRM/Contact/DAO/SavedSearch.php
CRM/Upgrade/Incremental/php/FiveTwentyFour.php
xml/schema/Contact/SavedSearch.xml

index 5933323c54162fc34cdecea55a8c18ba6dd6ef8d..f607b006b03180fa29ef3124cb8e2a11e6724c52 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/SavedSearch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d2d8b39f5f8869d8c5295810f8f2ad78)
+ * (GenCodeChecksum:a60876bf99e330f6a463247686a92f31)
  */
 
 /**
@@ -56,6 +56,20 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
    */
   public $search_custom_id;
 
+  /**
+   * Entity name for API based search
+   *
+   * @var string
+   */
+  public $api_entity;
+
+  /**
+   * Parameters for API based search
+   *
+   * @var text
+   */
+  public $api_params;
+
   /**
    * Class constructor.
    */
@@ -136,6 +150,31 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
           'bao' => 'CRM_Contact_BAO_SavedSearch',
           'localizable' => 0,
         ],
+        'api_entity' => [
+          'name' => 'api_entity',
+          'type' => CRM_Utils_Type::T_STRING,
+          'title' => ts('Entity Name'),
+          'description' => ts('Entity name for API based search'),
+          'maxlength' => 255,
+          'size' => CRM_Utils_Type::HUGE,
+          'where' => 'civicrm_saved_search.api_entity',
+          'table_name' => 'civicrm_saved_search',
+          'entity' => 'SavedSearch',
+          'bao' => 'CRM_Contact_BAO_SavedSearch',
+          'localizable' => 0,
+        ],
+        'api_params' => [
+          'name' => 'api_params',
+          'type' => CRM_Utils_Type::T_TEXT,
+          'title' => ts('API Parameters'),
+          'description' => ts('Parameters for API based search'),
+          'where' => 'civicrm_saved_search.api_params',
+          'table_name' => 'civicrm_saved_search',
+          'entity' => 'SavedSearch',
+          'bao' => 'CRM_Contact_BAO_SavedSearch',
+          'localizable' => 0,
+          'serialize' => self::SERIALIZE_JSON,
+        ],
       ];
       CRM_Core_DAO_AllCoreTables::invoke(__CLASS__, 'fields_callback', Civi::$statics[__CLASS__]['fields']);
     }
index cee60608de0e67c3254ec283f3a2f58af8e3ee5b..1b90c51619ecdb3087ace833fe79c2598646e282 100644 (file)
@@ -46,12 +46,6 @@ class CRM_Upgrade_Incremental_php_FiveTwentyFour extends CRM_Upgrade_Incremental
     // }
   }
 
-  /*
-   * Important! All upgrade functions MUST add a 'runSql' task.
-   * Uncomment and use the following template for a new upgrade version
-   * (change the x in the function name):
-   */
-
   /**
    * Upgrade function.
    *
@@ -61,6 +55,12 @@ class CRM_Upgrade_Incremental_php_FiveTwentyFour extends CRM_Upgrade_Incremental
     $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
     $this->addTask('Install sequential creditnote extension', 'installCreditNotes');
     $this->addTask('Drop obsolete columns from saved_search table', 'dropSavedSearchColumns');
+    $this->addTask('Smart groups: Add api_entity column to civicrm_saved_search', 'addColumn',
+      'civicrm_saved_search', 'api_entity', "varchar(255) DEFAULT NULL COMMENT 'Entity name for API based search'"
+    );
+    $this->addTask('Smart groups: Add api_params column to civicrm_saved_search', 'addColumn',
+      'civicrm_saved_search', 'api_params', "text DEFAULT NULL COMMENT 'Parameters for API based search'"
+    );
   }
 
   /**
index e8437a08b912581361af581b76deca29a5cb3ebf..89f578084b3387200caef35c5c3c652fc5ad54eb 100644 (file)
     <add>1.6</add>
     <drop>5.24</drop>
   </field>
+  <field>
+    <name>api_entity</name>
+    <type>varchar</type>
+    <title>Entity Name</title>
+    <length>255</length>
+    <comment>Entity name for API based search</comment>
+    <add>5.24</add>
+  </field>
+  <field>
+    <name>api_params</name>
+    <type>text</type>
+    <title>API Parameters</title>
+    <comment>Parameters for API based search</comment>
+    <serialize>JSON</serialize>
+    <add>5.24</add>
+  </field>
 </table>