-
-
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
dev/core#190 / CRM-21643 ensure custom data multi record profile returns correct … #12337
Conversation
(Standard links)
|
CRM/Core/BAO/UFGroup.php
Outdated
@@ -993,8 +993,10 @@ public static function getValues( | |||
|
|||
$details = $query->searchQuery(0, 0, NULL, FALSE, FALSE, | |||
FALSE, FALSE, FALSE, $additionalWhereClause); | |||
if (!$details->fetch()) { | |||
return; | |||
while($details->fetch()) { |
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.
@lcdservices brian i suspect you will need a space between teh while and (
I think there is another open PR for this same issue - I just hadn't felt comfortable that the concept was approved in that it seems there could be other opinions about 'correct' behaviour |
@eileenmcnaughton you're right -- #11529 you're right as well that this PR is a bit different. @monishdeb can you review this one? it's pretty basic -- we just make sure we've cycled through the custom table rows to get to the last one before we continue. per the other PR, I really don't like the idea of concatenating values. that's not what the end user would expect and would get very confusing. |
@lcdservices is it solving the same 'problem' - ie. that the 'wrong' data is displayed? If so I think it could be debated & I think some steps should be taken to canvass opinions - perhaps email the dev list |
(given that there was relatively little response before I'm Ok with the principle that we will merge in 10 days if no dissent) |
@eileenmcnaughton yes, it's solving the same problem. I'm not sure it's that controversial. In the discussion on the other ticket, @monishdeb brought up the idea of concatenating values, but the prior discussion and his actual PR all seemed in agreement that the user would expect to see the values they just submitted. |
@lcdservices I may be wrong about people having differing opinions - but we have had conversations about multi-select fields before with people arguing that the 'right' field is the latest field - but actually they are all created equal |
@monishdeb @lcdservices I just looked at this again and tried to merge it with #11529 To the extent that it affects the screen UFGroup::getValues - that called from lots of places so this is not very contained - much as I hate to suggest it could we add a $isGetHighestID param to the function & handle that way? I was going to close one of the 2 issues in favour of the other - but I'll leave for a few days so you & Monish can choose one |
@monishdeb @lcdservices what about instead of that fetch loop just adding a last sort param of 'id DESC' or similar in here
ie something like
|
I'm not sure why, but adding the sort param doesn't work. |
@lcdservices I didn't test it I guessed the value - but the original PR won't work on all installs. Not all versions /configurations of mysql naturally sort by id - so for some sites the existing PR will give a random record |
I'm going to merge this - I don't think it's reliable & it should be tested but I'm going to accept that the most recent field is generally the best & this results in that in more cases than otherwise. Really we should put in a test - but this has hung around for a long time in various forms & it's really down to merge or reject at this stage & merge seems OK all considered |
…record
Overview
Ensure the most recently created record is retrieved after submitting custom multi data profile.
Steps to replicate:
Expected: The custom field should show the last data entered i.e. 'second data'
See: https://lab.civicrm.org/dev/core/issues/190
Before
After submitting a profile from create view that has custom multi fields, the post-submit profile view page displays the first record for that contact instead of the one just submitted.
After
The data for custom multi fields just submitted are displayed.
Technical Details
The query that gets the values for the profile needs to cycle through and get the last record instead of assuming a single record will be returned.
See #11529 for more discussion