Fix ajax error on rendering multi custom data tab when field limit reached #11856
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
Multiple Custom data fields permit a limit to be set. When this limit is set and a contact has that many rows entered an ajax error will prevent the custom data tab from rendering
Before
After
Technical Details
CRM_Contact_Page_View_CustomData::run() calls CRM_Profile_Page_MultipleRecordFieldsListing::run(). The latter function currently only assigns customGroupId to the tpl if the limit of rows to display has not been reached.
However, if the var is a required parameter for the ajax call that follow
s and without it the page does not render. There is no clue as to why it
is wrapped in the if and changing it does
not cause problems in the follow on ajax call
CRM_Custom_Page_AJAX::getMultiRecordFieldList
The only other place this is called from is
CRM_Profile_Form::preProcess when
mode is not EDIT and gid is set
I managed to test this flow but creating a profile with a multiple field & using the url
![screenshot 2018-03-22 14 58 10](https://user-images.githubusercontent.com/336308/37746932-74e331f0-2de1-11e8-8895-fa934c006628.png)
http://dmaster.local/civicrm/profile/edit?gid=15&reset=1&contactId=5
However, I concluded it was broken with and without this patch - ie. despite records existing I see
Comments
Anything else you would like the reviewer to note