From 1e0a0433b338f429005075c276643a7626a82c22 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Wed, 19 May 2021 11:05:16 -0400 Subject: [PATCH] SearchKit - Prevent overwriting SavedSearch.modified_date When saving a search, the modified_date was being overwritten with the old value. --- CRM/Contact/BAO/SavedSearch.php | 2 ++ CRM/Contact/DAO/SavedSearch.php | 4 +++- xml/schema/Contact/SavedSearch.xml | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/SavedSearch.php b/CRM/Contact/BAO/SavedSearch.php index 23135f1ad1..3d3c4f2785 100644 --- a/CRM/Contact/BAO/SavedSearch.php +++ b/CRM/Contact/BAO/SavedSearch.php @@ -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'])) { diff --git a/CRM/Contact/DAO/SavedSearch.php b/CRM/Contact/DAO/SavedSearch.php index 998baf20fb..2f607703c1 100644 --- a/CRM/Contact/DAO/SavedSearch.php +++ b/CRM/Contact/DAO/SavedSearch.php @@ -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' => [ diff --git a/xml/schema/Contact/SavedSearch.xml b/xml/schema/Contact/SavedSearch.xml index a06a794ab1..1be44e62ff 100644 --- a/xml/schema/Contact/SavedSearch.xml +++ b/xml/schema/Contact/SavedSearch.xml @@ -144,6 +144,7 @@ + true 5.36 @@ -185,6 +186,7 @@ When the search was created. true CURRENT_TIMESTAMP + true 5.36 -- 2.25.1