Skip to content
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

Fix ajax error on rendering multi custom data tab when field limit reached #11856

Merged
merged 1 commit into from
Mar 22, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Mar 22, 2018

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

screenshot 2018-03-22 13 52 13

After

screenshot 2018-03-22 14 24 15

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
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
screenshot 2018-03-22 14 58 10

Comments

Anything else you would like the reviewer to note

…ached.

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
@eileenmcnaughton
Copy link
Contributor Author

@lcdservices perhaps you could check this. It's a bug I hit while testing something else rather than something I'm vested in but I'm pretty confident the fix does not cause any downside

@lcdservices
Copy link
Contributor

@eileenmcnaughton I reproduced the error w/o the patch, and confirmed it's fixed with the patch.

Re: the profile -- you likely didn't check the option to include at least one field in the multi-record listing (see screenshot). We would benefit from better error messaging on the profile edit screen when that's the case. But multi-records in profiles does work -- I test both with and without this patch.

image

@seamuslee001
Copy link
Contributor

(CiviCRM Review Template WORD-1.1)

@seamuslee001 seamuslee001 merged commit 5e71b14 into civicrm:master Mar 22, 2018
@eileenmcnaughton eileenmcnaughton deleted the cust_multi branch March 22, 2018 21:33
@eileenmcnaughton
Copy link
Contributor Author

thanks @seamuslee001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants