Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SearchKit - Fix in-place edit of relationships and dates #21533

Merged
merged 1 commit into from
Sep 20, 2021

Conversation

colemanw
Copy link
Member

Overview

Makes relationship fields in-place editable on SearchKit, and fixes in-place editing of dates.

Before

Date fields were not rendering correctly, and relationships could not be edited due to the read-only nature of the relationshipCache table.

After

Relationship start date, end date, is_active, and custom fields can be edited in-place on search displays.

Technical Details

No fields in the RelationshipCache table are editable directly, so this tricks SearchKit into thinking they belong to the Relationship entity.

Comments

Also fixes a couple bugs related to in-place editing caused by the refactoring done in #21528

Date fields were not rendering correctly, and relationships
could not be edited due to the read-only nature of the relationshipCache table.
@civibot
Copy link

civibot bot commented Sep 19, 2021

(Standard links)

@civibot civibot bot added the master label Sep 19, 2021
@francescbassas
Copy link
Contributor

@colemanw I tested here http://core-21533-8p4gv.test-3.civicrm.org:8001/civicrm/admin/search#/edit/1 and all works as expected. Only one thing. I enabled one custom field for only one relationship type and in-place edit is "working" for all relationship types. Maybe in-place edit should be disabled if custom field not apply on a specific relationship type?

@colemanw colemanw merged commit ec5e412 into civicrm:master Sep 20, 2021
@colemanw colemanw deleted the relEdit branch September 20, 2021 16:29
@colemanw
Copy link
Member Author

Thanks @francescbassas for testing. I can try to do a separate fix for the custom data issue.

@francescbassas
Copy link
Contributor

@colemanw I was returning on this #21533 (comment) and testing a little more. I have been able to verify that the problem probably extends to other entities beyond relationships. For example it's possible to have an in place edit for all contacts for a set of custom fields defined only for a contact subtype. Are my observations correct?

A possible solution that I imagine at the UI level is to disable editing for fields that do not belong to this type of data (contact, activity, relationship, etc.) with a tooltip that warns of the reason (eg "this field type is only defined for Volunteer contact subtype").

I imagine it’s nothing immediate to implement but I’m sure something good to register as an issue in order to keep it in mind, to be able to discuss it and make it extended to the rest of the community.

@colemanw
Copy link
Member Author

@francescbassas it's currently not possible to do complex permission or data-integrity checks with client-side rendering, which is why I'm switching a lot of the rendering to server-side in #21820 which should make these sorts of checks possible.

@francescbassas
Copy link
Contributor

@colemanw is there any recent news in the Searchkit that allows to tackle the problem of editing non-pertinent custom fields? If not, perhaps it is better to open a separate issue?

@colemanw
Copy link
Member Author

@francescbassas agreed. Please open a new issue on GitLab and tag searchKit. I do think we need to fix that problem.

@francescbassas
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants