Skip to content

Commit

Permalink
Merge pull request #13966 from agileware/CIVICRM-1168
Browse files Browse the repository at this point in the history
Fixed visibility logic on Price field options.
  • Loading branch information
eileenmcnaughton authored Jun 13, 2019
2 parents 4c27465 + c8ac8c5 commit d6c79fe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CRM/Price/Form/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,10 +314,10 @@ public static function formRule($fields, $files, $form) {
$publicCount++;
}
}
if ($visibilityOptions[$priceField->visibility_id] == 'public' && $publicCount == 0) {
if ($visibilityOptions[$priceField->visibility_id] == 'public' && $publicCount == 0 && $visibilityOptions[$fields['visibility_id']] == 'admin') {
$errors['visibility_id'] = ts('All other options for this \'Public\' field have \'Admin\' visibility. There should at least be one \'Public\' option, or make the field \'Admin\' only.');
}
elseif ($visibilityOptions[$priceField->visibility_id] == 'admin' && $publicCount > 0) {
elseif ($visibilityOptions[$priceField->visibility_id] == 'admin' && $visibilityOptions[$fields['visibility_id']] == 'public') {
$errors['visibility_id'] = ts('You must choose \'Admin\' visibility for this price option, as it belongs to a field with \'Admin\' visibility.');
}

Expand Down

0 comments on commit d6c79fe

Please sign in to comment.