SearchKit - Prevent overwriting SavedSearch.modified_date
authorColeman Watts <coleman@civicrm.org>
Wed, 19 May 2021 15:05:16 +0000 (11:05 -0400)
committerColeman Watts <coleman@civicrm.org>
Thu, 20 May 2021 12:23:52 +0000 (08:23 -0400)
When saving a search, the modified_date was being overwritten with the old value.

CRM/Contact/BAO/SavedSearch.php
CRM/Contact/DAO/SavedSearch.php
xml/schema/Contact/SavedSearch.xml

index 23135f1ad1165fdefe4b1e19abfa6b2aa61ea913..3d3c4f2785abb68b56515f3d484d83bbeb32bce8 100644 (file)
@@ -362,6 +362,8 @@ LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_
       }
       $params['modified_id'] = $loggedInContactID;
     }
+    // Set by mysql
+    unset($params['modified_date']);
 
     // Flush angular caches to refresh search displays
     if (isset($params['api_params'])) {
index 998baf20fbb2414d4d037480ab93c07b0283c4df..2f607703c1b0b3c453b1a32e81c599059c3ffc81 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Generated from xml/schema/CRM/Contact/SavedSearch.xml
  * DO NOT EDIT.  Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fe46c2b4900f1fdde4a90f4858710fde)
+ * (GenCodeChecksum:8a25df5165c48a42f0280efe9eb262d5)
  */
 
 /**
@@ -306,6 +306,7 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
           'html' => [
             'label' => ts("Created By"),
           ],
+          'readonly' => TRUE,
           'add' => '5.36',
         ],
         'modified_id' => [
@@ -350,6 +351,7 @@ class CRM_Contact_DAO_SavedSearch extends CRM_Core_DAO {
           'entity' => 'SavedSearch',
           'bao' => 'CRM_Contact_BAO_SavedSearch',
           'localizable' => 0,
+          'readonly' => TRUE,
           'add' => '5.36',
         ],
         'modified_date' => [
index a06a794ab136433e82b1cd1b99439f660a97652c..1be44e62ff9c1624a90272367b7a42fa6401c558 100644 (file)
     <html>
       <label>Created By</label>
     </html>
+    <readonly>true</readonly>
     <add>5.36</add>
   </field>
   <foreignKey>
     <comment>When the search was created.</comment>
     <required>true</required>
     <default>CURRENT_TIMESTAMP</default>
+    <readonly>true</readonly>
     <add>5.36</add>
   </field>
   <field>