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

Support saving more than 25 records in Profile.submit api #20744

Merged
merged 1 commit into from
Jul 1, 2021
Merged

Support saving more than 25 records in Profile.submit api #20744

merged 1 commit into from
Jul 1, 2021

Conversation

deb1990
Copy link
Contributor

@deb1990 deb1990 commented Jul 1, 2021

Overview

When we try to Save more than 25 records using Profile.submit api, only 25 records gets saved. This PR fixes that.

Before

Profile.Submit only saves 25 records.

After

Profile.Submit saves all records.

Technical Details

While submitting Profile values, using Profile.submit, the following line gets called, which fetches the fields for current profile.
https://github.com/civicrm/civicrm-core/blob/master/api/v3/Profile.php#L162

Now, internally the _civicrm_api3_buildprofile_submitfields function gets called, which fetches uf_field using https://github.com/civicrm/civicrm-core/blob/master/api/v3/Profile.php#L503. As limit: 0 is not mentioned here, only the first 25 records get returned. Thats why, all the records sent in Profile.submit does not get saved.

To fix this, the same line has been changed to $fields = civicrm_api3('uf_field', 'get', ['uf_group_id' => $profileID, 'options' => ['limit' => 0]]);.

Another alternative would be, to send the limit parameter in Profile.submit api call itself, but as it is a "Create" api call, and we do not need to send limit parameter for other "Create" api calls in CiviCRM, its best that we do the same in this case also, to keep consistency.

@civibot
Copy link

civibot bot commented Jul 1, 2021

(Standard links)

@civibot civibot bot added the master label Jul 1, 2021
@deb1990 deb1990 marked this pull request as draft July 1, 2021 06:52
@deb1990 deb1990 changed the title RSESPRT-64: Support saving more than 25 records in Profile.submit api Support saving more than 25 records in Profile.submit api Jul 1, 2021
@monishdeb
Copy link
Member

monishdeb commented Jul 1, 2021

Makes sense. @deb1990 are you still working on this PR?

@deb1990 deb1990 marked this pull request as ready for review July 1, 2021 16:57
@deb1990
Copy link
Contributor Author

deb1990 commented Jul 1, 2021

@deb1990 No, its ready for review now.

@monishdeb
Copy link
Member

Cool. Tested on local, looks good. Merging now.

@monishdeb monishdeb merged commit cdb0dde into civicrm:master Jul 1, 2021
deb1990 added a commit to compucorp/civicrm-core that referenced this pull request Jul 5, 2021
deb1990 added a commit to compucorp/civicrm-core that referenced this pull request Jul 5, 2021
erawat pushed a commit to compucorp/civicrm-core that referenced this pull request Sep 14, 2021
erawat pushed a commit to compucorp/civicrm-core that referenced this pull request Sep 14, 2021
erawat pushed a commit to compucorp/civicrm-core that referenced this pull request Sep 14, 2021
erawat pushed a commit to compucorp/civicrm-core that referenced this pull request Sep 14, 2021
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.

2 participants