dev/core#2691 - On logging detail civireport show words instead of numbers (part 2) #20907
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
https://lab.civicrm.org/dev/core/-/issues/2691
This is a followup to #20844 which only addressed activity record type. This addresses foreign keys, displaying more useful words instead of the foreign key id, e.g.
fk activity_id => activity subject
orfk contact_id => display_name
.Before
Something like this
After
Something like this:
Technical Details
There's metadata available that says if a field is a foreign key and then on the foreign class there's metadata that tells you what would be meaningful to display as a label for that record. So this looks up that label. I'm not sure if there's already an api4 function available that takes a table+field and gets it for you.
For the test I had to work around something that only comes up in tests where logging will always have the same connection id throughout the entire run, whereas in real life on different page requests there'll be a different connection id corresponding to each change. The logging detail report relies on the connection id to tell what db records were associated with a change, so if I don't artificially fiddle with it then it thinks everything that has happened since the start is all one big change.
Comments