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

dev/core#227 Fix issue where on some extened groups the multiple reco… #12400

Merged
merged 1 commit into from
Jul 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CRM/Core/BAO/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ public static function create(&$params) {
'is_multiple'
);

if ($params['is_multiple'] != $isMultiple) {
// dev/core#227 Fix issue where is_multiple in params maybe an empty string if checkbox is not rendered on the form.
$paramsIsMultiple = empty($params['is_multiple']) ? 0 : 1;
if ($paramsIsMultiple != $isMultiple) {
$tableNameNeedingIndexUpdate = CRM_Core_DAO::getFieldValue(
'CRM_Core_DAO_CustomGroup',
$params['id'],
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/api/v3/CustomGroupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ public function testCustomGroupEmptyUpdate() {
$this->callAPISuccess('CustomGroup', 'create', ['id' => $customGroup['id']]);
}

/**
* Test an update when is_multiple is an emtpy string this can occur in form submissions for custom groups that extend activites.
* dev/core#227.
*/
public function testCustomGroupEmptyisMultipleUpdate() {
$customGroup = $this->callAPISuccess('CustomGroup', 'create', array_merge($this->_params, ['is_multiple' => 0]));
$this->callAPISuccess('CustomGroup', 'create', ['id' => $customGroup['id'], 'is_multiple' => '']);
}

/**
* Check with Activity - Meeting Type
*/
Expand Down