-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
[REF] Move more code to the trait [WIP] #16936
Conversation
(Standard links)
|
7f392e5
to
4e08a5f
Compare
@colemanw I wanted to check your thoughts on this - 4e08a5f - basically it's an attempt to change the ad-hoc ajax to be an entity reference (& over up the refine search goodness). That patch only touches the BCC field (not to or cc) However, I hit a couple of limitations
Thoughts on the best approach? Note that the query gets slow if you do sort_name LIKE 'c%' OR email LIKE 'c%' & you really need a union |
The function CRM_Contact_Page_AJAX::getContactEmail is one of our earlier ajax attempts & this approach has been largely replaced with entity Reference fields. In order to switch over we need to bring Email.getlist api to parity which means 1) searching on sortname first, if less than 10 results on emails include emails 2) appropriate respect for includeWildCardInName (this should already be in the generic getlist) 3) filter out on_hold, is_deceased, do_not_email 4) acl support (should already be part of the api). The trickiest of these to support is the first - because we need to avoid using a non-performant OR My current solution is the idea of a fallback field to search if the search results are less than the limit. in most cases this won't require a second query but when it does it should be fairly quick.
The function CRM_Contact_Page_AJAX::getContactEmail is one of our earlier ajax attempts & this approach has been largely replaced with entity Reference fields. In order to switch over we need to bring Email.getlist api to parity which means 1) searching on sortname first, if less than 10 results on emails include emails 2) appropriate respect for includeWildCardInName (this should already be in the generic getlist) 3) filter out on_hold, is_deceased, do_not_email 4) acl support (should already be part of the api). The trickiest of these to support is the first - because we need to avoid using a non-performant OR My current solution is the idea of a fallback field to search if the search results are less than the limit. in most cases this won't require a second query but when it does it should be fairly quick.
This is still overriden on the contact email.
I have duplicated this code rather than moving it in case any non-core code calls it. We can remove in a bit
Overview
Follow on cleanup commits from #16935
This affects code to send emails called from
Before
Emails task forms work. Code very nasty
After
Emails task forms work. Code moving towards readability
Technical Details
I'll keep adding to this & likely spin stuff off if #16935 is merged (unless someone wants to review / merge this)
Comments