-
-
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
Search ext: support complex joins & HAVING clause in api4 smart groups #18644
Conversation
(Standard links)
|
Failure looks unrelated. retest this please |
@colemanw I tried to figure out how to test this - I thought I might have been able to create a smart group like this but I can't civicrm/search#/create/LineItem/?join=%5B%5B"Contribution%20AS%20contribution",false%5D,%5B"PriceField%20AS%20price_field",false%5D%5D&select=%5B"financial_type_id:label","contribution.contact_id","qty","line_total"%5D&where=%5B%5B"line_total",">","2"%5D%5D I also can't spot any new 'having' option civicrm/search#/create/LineItem/?join=%5B%5B"Contribution%20AS%20contribution",false%5D,%5B"PriceField%20AS%20price_field",false%5D%5D&select=%5B"GROUP_CONCAT(DISTINCT%20financial_type_id:label)","GROUP_CONCAT(contribution.contact_id)","SUM(qty)","SUM(line_total)"%5D&where=%5B%5B"line_total",">","2"%5D%5D&groupBy=%5B"price_field_value_id","financial_type_id"%5D |
@eileenmcnaughton your first screenshot seems to not have this PR applied. The "Missing contact_id" error message is different in this version, so likely you need to ensure the patch is applied and flush caches. In the Search UI, the "HAVING" clause is named "Filter" and appears in the right column underneath the "Where" criteria. It is only visible when one or more grouping columns is selected... although once more sql functions are allowed it might be useful even when grouping isn't in use, so I'll probably lift that restriction. |
Hmm seems to work but the actual save |
On the having - this should return rows but doesn't I believe |
@eileenmcnaughton I clicked on that link and without tweaking any of the criteria I clicked "Search" and it gave me 3 results: |
…d in GROUP_BY The bug was that it wasn't recognizing the column name after a function was added to it.
@eileenmcnaughton I've updated this PR. I think everything is now working as it should. |
@colemanw - locally still hitting IDS issues - I'll try on the test site once it's stable - note 'action' is not resolved |
@eileenmcnaughton you can always give yourself the IDS bypass permission locally |
@colemanw if you want to punt IDS to a separate PR / follow up I'll test as admin - I think it's important to fix but happy to not make it blocking on this |
Actually @colemanw I get that unresolved action tag for demo user even when the params are not in the url |
@lcdservices is this on your radar - this will make it possible to create smart groups based on line items. I currently see some limitations (which I'll worry about once these changes are finalised) - but I suspect you will have good input on it. |
@eileenmcnaughton I think again the problem was you're using an outdated test site. That error was fixed by 7a56c06 and looks good to me on the latest demo: |
Angular 1.8 doesn't seem to like it when you try to access component properties before the init function.
OK - I agree that link works & I was able to
Let's merge this & then try to put some use cases through it |
Thanks @eileenmcnaughton I pushed up one more small tweak for code sanitation so we'll wait for this latest test run then merge. |
Overview
Improves the new search extension and APIv4 smart groups in core to support any entity that can join with Contact, including full support for calculated fields and the HAVING clause.
Before
Limited smart group support.
After
Improved smart group support; with test.