Skip to content

Commit

Permalink
CIVICRM-1168: Fixed visibility logic on Pricefield options.
Browse files Browse the repository at this point in the history
  • Loading branch information
agilewarealok committed Apr 4, 2019
1 parent 18fe192 commit c8ac8c5
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 c8ac8c5

Please sign in to comment.