-
-
Notifications
You must be signed in to change notification settings - Fork 827
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
dev/report#53: search on relationship and case (2) #20002
Conversation
(Standard links)
|
Can we get a unit test for this? We've been pretty strict for a long time about not having changes to advanced search without adding tests. I know we let your last one through without but we really should stick to it since this has been some of the hardest code to maintain. The current failure should give a good starting point CRM_Contact_SelectorTest::testSelectorQuery with data set #10 (array('Test display relationships', 'CRM_Contact_Selector', array(), array('1_b_a'), null, array(), 'advanced', 0, null, false, array('SELECT contact_a.id as contac...egion`', 'WHERE displayRelType.relation...d = 0)'))) /home/jenkins/bknix-dfl/build/core-20002-a4wl/web/sites/all/modules/civicrm/tests/phpunit/CiviTest/CiviUnitTestCase.php:2667 |
I have fixed the failing test. |
$clientContactID = $this->individualCreate(['first_name' => 'John', 'last_name' => 'Smith']); | ||
$benefitSpecialist1 = $this->individualCreate(['Individual', 'first_name' => 'Alexa', 'last_name' => 'Clarke']); | ||
$benefitSpecialist2 = $this->individualCreate(['Individual', 'first_name' => 'Sandra', 'last_name' => 'Johnson']); | ||
$housingSupportCase = $this->createCase($clientContactID, NULL, ['case_type_id' => 'housing_support', 'case_type_id' => 1]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a typo: case_type_id used twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes indeed is a typo
@@ -5837,10 +5837,11 @@ public function filterRelatedContacts(&$from, &$where, &$having) { | |||
else { | |||
$from .= $qcache['from']; | |||
} | |||
$where = $qcache['where']; | |||
$where .= $qcache['where']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of remember this code area from the earlier PR but I don't remember if there was ever a time when $where was passed in to the function and is blank or didn't have "WHERE" in it already. I wonder if it's worth adding a guard against that, e.g. if $where does not contain "WHERE", then $where = "WHERE (1) " . $qcache['where']
. Or something like that - just an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a check whether $where is empty.
In case the jenkins log expires:
|
Thanks for storing the jenkins log. I have fixed the failing test. |
Thanks @jaapjansma I think this is ok to merge.
|
merging based on @demeritcowboy review |
Just noting this appears to have caused a regression - #20997 |
@jaapjansma we made the call to revert this for now in order to fix the regression & get the releases out. @jmcclelland added a test for the regression so we can be confident it won't regress again. Note your test was not reverted - just marked incomplete for now. I will re-open in gitlab |
Actually the original issue had a whole lot of stuff in it not just this so I opened https://lab.civicrm.org/dev/report/-/issues/72 to track |
Overview
When doing an advanced search with case parameters set and displaying related contacts. Gives all clients of all the found cases which have this relationship. What we would expect is that related contact is linked to the found cases.
Steps to reproduce
Preparation:
Searching:
Expected results
I expected to see only Contact B as that one has a relationship on the case Housing Support.
Actual results
I see both Contact B and Contact C.
Comments
See also the discussion of a similar related topic: https://lab.civicrm.org/dev/report/-/issues/53